Unable to get behaviour of Switch case in java

后端 未结 8 723
迷失自我
迷失自我 2021-01-23 14:07

I have written small code in java 6

public class TestSwitch{

public static void main(String... args){
    int a = 1;
    System.out.println("start");
          


        
8条回答
  •  醉梦人生
    2021-01-23 14:40

    You have wrong closing braces before case 2. case 3,4 are interpreted as labels not cases.

提交回复
热议问题