发布时间 : 星期一 文章JAVA第一阶段基础测试题,java变量,运算符,分支,循环测试题更新完毕开始阅读8e9963ea453610661fd9f485
case 7: h++; case 8: h++; case 9: h += 2; case 10: h += 3; default: h /= j; }
System.out.println(h); } A.59 B.61 C.2 D.1
正确答案:C解析: 14.
下列代码的输出结果是:()。 public static void main(String[] args) { int one = 1, two = 10, three = 8;
if (one > 2) { if (two < 5) {
System.out.println(\ } else {
System.out.println(\ }
} else if (three > 5) { System.out.println(\ } else {
System.out.println(\ } } A.one B.two C.three D.four
正确答案:C解析: 15.
下面程序的输出结果是:()。 public static void main(String[] args) { int s = 105; int result = 0;
while (s > 0) { int m = s % 10; result += m; s /= 10; }
System.out.println(result); } A.6 B.10 C.5 D.20
正确答案:A解析: 16.
关于下列代码说法正确的是:()。public static void main(String[] args) { int words = 40;
System.out.println(words); System.out.println(computers); words = 67.9; }
A.编译正确
B.代码System.out.println(words);行,编译出错
C.代码System.out.println(computers);行,编译出错 D.代码words = 67.9;行,编译出错 正确答案:CD解析: 17.
请看下列表达式正确的是:()。 A.String ename = \ B.int $words=40; C.float _top =23.9; D.double ~balance = 99.9; 正确答案:AB解析: 18.
下列数组定义及赋值,正确的是:()。 A.byte[] arr = new byte [15]; B.byte arr = new byte [20]; C.byte arr[]={1,2,3,4,5}; D.byte[10] arr= new byte[]; 正确答案:AC解析: 19.
请看下列代码: public static void main(String[] args) { 《插入代码》 if (isRight) { System.out.println(\!\请在《插入代码》处,填入变量isRight声明的同时,进行初始化的代码:()。 A.boolean isRight=false;
B.int isRight=1; C.int isRight=0; D.boolean isRight = true; 正确答案:AD解析: 20.
下列选项的数据类型中,能存储汉字“达”的是:()。 A.int B.byte C.short D.char
正确答案:AD解析: