zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

android switch(String)错误:Cannot switch on a value of type String for source level below 1.7

Android错误On string for of Cannot type
2023-09-27 14:23:20 时间
switch语句的判断条件可以接受int,byte,char,short,不能接受其他类型
只有JDK版本1.7以上才可以支持String

设置如下可解决问题:(若没有JDK1.7版,可下载一下安装)
菜单选项--》project->properties->java compiler->compiler compliance level:选1.7即可