给定控制台应用程序的输出是什么?( )
public class Test34 {
public static void main(String[] args) {
int a = 2;
switch(a) {
default:
System.out.print("_default");
break;
case 0:
System.out.print("_ZERO");
case 1:
System.out.print("_ONE");
}
}
}_ZERO
_ZERO_ONE
_default_ZERO_ONE
_default
switch语句中,default代码段位置可以前置,和if语句不同,不影响执行。