IntelliJ switch statement using Strings error: use -source 7

前端 未结 3 1952
遇见更好的自我
遇见更好的自我 2021-01-11 19:31

I\'m trying to use IntelliJ (on Mac OS X) to compile some code I wrote using Eclipse. I\'ve attempted to run the following code:

switch (category) {
    case         


        
3条回答
  •  时光说笑
    2021-01-11 20:25

    Remember that using Strings in switch statements is only supported from JDK 1.7 onwards. The default project settings of IntelliJ might not be using JDK 1.7 as default. Change them from the project settings to JDK 1.7.

提交回复
热议问题