java: error: invalid source release: 16 - solution

Table of contents

Problem Description

solution


Problem Description

1. After running the code, the IDEA console outputs an error:

2. Since the code statement instanceof compiled this time must use language level 16

 3. At this time, click on the file--project structure--project, and check the SDK and project language level of the found project as shown in the figure below

solution

4. After searching, it is found that the SDK of the project does not match the language level of the project. Download version 16 of the JDK

5. Changed configuration

 

 6. After downloading, click the application in the lower right corner, and the operation is successful.

Guess you like

Origin blog.csdn.net/weixin_50576361/article/details/131581078