First of all, the main reason for this problem is that the Javac version of the compilation conflicts with the version of the actual project compilation, so the problem is solved from these aspects:
1. View the project JDK version and language level, File-->project structrue-->project
2. View the level of compilation, File-->settings-->build,execution,deployment-->compiler-->java Compiler Modify the level of compilation
3. For MAVEN projects you can configure the compiled version within the Pom file
(1) Configure in the Properties tab
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><Maven.compiler.source>1.8</Maven.compiler.source><Maven.compiler.target>1.8</Maven.compiler.target>
(2) Configure the compiler plugin within the Build-->plugins tab, as well as configure the compiled version (detailed configuration reference for the plugin http://maven.apache.org/plugins/ maven-compiler-plugin/compile-mojo.html)
<plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-compiler-plugin</Artifactid> <version>3.7.0</version> <Configuration> <Source>1.8</Source> <Target>1.8</Target> </Configuration></plugin>
Maven compiles Java project issues (primarily for idea)--error:java: Invalid target release: 1.8