题目内容

请阅读下面的程序 class Demo{ public static void main(String[] args){ int[] arr = new ____; if(arr.length==4) System.out.println(“数组定义完毕”); } } 在空白处填写代码,令代码完成输出“数组定义完毕”的功能。

查看答案
更多问题

编写程序,定义一个存储int类型的数组,存储的数据是10,11,12,要求输出数组中第一个元素的值。

阅读下面的程序 public class Test { public static void main(String[] args) { for(int x = 0 ; x <=3 ; x++){ continue; System.out.print(x%2); } } } 运行结果正确的是()

A. 0123
B. 0121
C. 012
D. 编译失败

请阅读下面的程序public class Example {public static void main(String[] args) {char c = 'B';switch(c) {case 'A':System.out.println("优");break;case 'B':System.out.println("良");break;case 'C':System.out.println("差");break;}}}

A. 优
B. 良
C. 差
D. 编译失败

请阅读下面的程序:public class Test { public static void main(String[] args) { int a = 0; int b = 0; for (int i = 1; i <= 5; i++) { a = i % 2; while (a-- >= 0) { b++; } } System.out.println(“a=” + a + “,b=” + b); } } 下列选项中,哪一个是正确的运行结果( )

A. a=2,b=-8
B. a=-2,b=8
C. a=-2,b=-8
D. a=2,b=8

答案查题题库