今天在编译执行下面这段代码的时候,编译报错:javacTask: 源发行版 1.8 需要目标发行版 1.8

public class Test {
public static void main(String[] args) { String b="b";
switch(b){
case "a":
System.out.println("A");
break;
case "b":
System.out.println("B");
break;
case "c":
System.out.println("C");
break;
}
}
}

参考:http://www.cnblogs.com/cxj20160928/p/5954336.html

  1. File-->Project Structure-->Project-->Project SDK 和 Project Language Level
  2. File-->Project Structure-->Modules-->Source-->Language Level
  3. File-->Settings-->Build, Execution, Deployment-->Compiler-->java compiler-->Project bytecode version 和Per_module bytecode version的Target bytecode version

参考:http://www.cnblogs.com/cxj20160928/p/5954336.html

05-11 20:07