switch语句的判断条件可以接受int,byte,char,short,不能接受其他类型
只有JDK版本1.7以上才可以支持String

你可能会说我的jdk是1.7以上啊,

这里说的版本是java解释器的版本,

eclipse修改办法:

项目右键 > project > properties > java compiler > compiler> compliance level:选1.7或以上

Cannot switch on a value of type String for source level below 1.7. Only

点击应用就好了

相关文章:

  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-08-28
  • 2022-12-23
猜你喜欢
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2021-07-10
  • 2022-12-23
相关资源
相似解决方案