switch case statement error: case expressions must be constant expression

后端 未结 9 1401
予麋鹿
予麋鹿 2020-12-04 07:51

My switch-case statement works perfectly fine yesterday. But when I run the code earlier this morning eclipse gave me an error underlining the case statements in color red a

9条回答
  •  旧巷少年郎
    2020-12-04 08:23

    Simple solution for this problem is :

    Click on the switch and then press CTL+1, It will change your switch to if-else block statement, and will resolve your problem

提交回复
热议问题