int i = 1, j = -1;
switch (i) {
case 0:
j = 1;
case 1:
j = 1;
case 2:
j = 2;
default:
j = 0;
}
System.out.println("j=" + j);
What is the result?
为什么结果老是 0 呢?大家帮忙解释下,谢谢
...全文
1034打赏收藏
大家帮我看下这段代码
int i = 1, j = -1; switch (i) { case 0: j = 1; case 1: j = 1; case 2: j = 2; default: j = 0; } System.out.println("j=" + j); What is the result? 为什么结果老是 0 呢?大家帮忙解释下,谢谢