题目内容

运行下面这段代码的结果为________________。int day = 3;switch(day){ case 1: case 3: case 5: System.out.print("学钢琴!"); break; case 2: System.out.print("学英语!"); default: System.out.print("去必胜客吃饭!");}

A. 学钢琴!
B. 学钢琴!学英语!
C. 学钢琴!去必胜客吃饭!
D. 没有任何输出

查看答案
更多问题

将以下哪种方法插入到第6行是不合法的( ) 。1.public class Test1 { 2. public float aMethod(float a,float b) throws 3. IOException { } 4. } 5.public class Test2 extends Test1{ 6. 7.}

A. float aMethod(float a,float b){ }
B. public int aMethod(int a,int b)throws Exception{ }
C. public float aMethod(float p,float q){ }
D. public int aMethod(int a,int b)throws IOException{ }

public class Example25 { public static void main(String[] args) { int[] arr = new int[4]; // 定义一个长度为4的数组 System.out.println("arr[0]=" + arr[4]); // 通过索引4访问数组元素 }}这个例子在执行的时候会错吗?

A. 错误
B. 不会错误

分析下面的Java代码,输出的结果为( )。int i=0;for(;i<4;i+=2){ System.out.print (i+",");}System.out.println (i);

A. 0,2
B. 0,2,4
C. 0,2,4,6
D. 0,1,2,3

如果有以下关于变量赋值的程序代码:float radius = 88.2; double area= 3.14 * radius * radius; System.out.println(area);

A. 执行时显示48853.6272
B. 执行时显示48853
C. 执行时出现错误
D. 编译失败

答案查题题库