编译报错,Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum constants are permitted
jdk安装的是1.7的,为什么还报这样的错误,求解
MyEclipse 报错:(虽然有显示乱码,但是已经把项目那些设置成UTF-8格式的了)
An error occurred at line: 160 in the jsp file: /module/tool/hsCode/detail.jsp
Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum constants are permitted
157: <%
158: for(char c: code.getInspection().trim().toCharArray()){
159: String key = String.valueOf(c);
160: switch(key){
161: case "M":
162: out.println("杩涘彛鍟嗗搧妫?獙");
163: break;
Stacktrace:
不能用字符串当作值,得转化成数值类型或枚举类型
发下报错位置的代码吧
只有jdk1.7及以上的版本才能支持switch分支传入String类型,试试去掉你贴图右侧的第二个复选框的勾。