IntelliJ switch statement using Strings error: use -source 7

前端 未结 3 1954
遇见更好的自我
遇见更好的自我 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:15

    In case anyone still gets this error message after following the advice to check the File > Project Structure -> Project and set appropriate Project language level.

    Be sure to also check File > Project Structure> Modules, to see if all your modules are on the correct Language Level: (or the specific desired level).

    There is also one more place where this can go wrong, which is: File > Settings > Compiler > Java Compiler. There you can set the project and module's java compiler version.

    (For IntelliJ version <= 12 : Project Structure => Project Settings)

提交回复
热议问题