在java语言的控制结构中,break语句是经常用到的语句,在switch语句中break语句起到( )的作用。
A. 结束当次循环,使控制权直接转移到控制循环的条件表达式
B. 从嵌套循环内部跳出最里面的循环
C. 终止switch语句的语句序列,提高switch-case语句性能
D. 退出循环
查看答案
读程序,控制台运行结果是( )int a = 10; int b = 20; int c = a + b;int d = a - b;System.out.println("c =" + c);System.out.println("d =" + d);
A. c=10,d =10
B. c=20,d=10
C. c=30,d=-10
D. c=20,d=-10
下面哪条语句正确定义了5个元素的数组( )
A. int [] a={22,23,24,25,12};
B. int a []=new int(5);
C. int [5] array;
D. int [] arr;
下面的程序,输出的结果是?public class SwitchTest {public static void main(String args[ ]){int a = 5 + (int)1.2 + (int)0.8;switch (a) {case 6:System.out.println("结果等于6");break;case 7:System.out.println("结果等于7");break;case 8:System.out.println("结果等于8");break;default:System.out.println("结果等于其它值");}}}
A. 结果等于6
B. 结果等于7
C. 结果等于8
D. 结果等于其它值
E. 代码有误,无法运行
下列语句中,______________能正确完成整型变量的声明和赋值。
A. int count, count=0;
B. int count=0;
C. count=0;
D. int a=0; count=a;