如下代码为何还会执行for循环,明明for循环在case 30里面呀?
public class Test {
public static void main(String args[]){
int x = 40;
switch( x ){
case 10:
System.out.print("Value of X is 10");
break;
case 20:
System.out.print("Value of X is 20");
break;
case 30:
System.out.println("Value of X is 30");
for(;x<=50;){
x++;
}
//break;
case 40:
System.out.println("Value of X is 40");
//break;
case 50:
System.out.println("Value of X is 50");
//break;
default:
System.out.println("这是 default 语句");
}
System.out.print("x=" + x);
}
}