1.Project Structure中的Project SDK選擇1.8,Project language level選擇8

2.Project Structure中Modules,選擇language level為8

3.setting中的java compiler,project bytecode version和Target bytecode version 選擇1.8

其他方法:
Maven配置
<build>
<pluginManagement>
<plugins>
<!--控制項目的language level和compile 版本-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
