题目内容

假设income的值为4001,下面代码的输出是_________if (income > 3000) { System.out.println("Income is greater than 3000"); } else if (income > 4000) { System.out.println("Income is greater than 4000"); }

A. Income is greater than 3000
B. Income is greater than 3000 followed by Income is greater than 4000
C. Income is greater than 4000
D. Income is greater than 4000 followed by Income is greater than 3000

查看答案
更多问题

以下代码的输出是_________?double temperature = 50; if (temperature >= 100) System.out.println("too hot"); else if (temperature <= 40) System.out.println("too cold"); else System.out.println("just right");

A. too hot
B. too cold
C. just right
D. too hot too cold just right

假设x=1,y=-1,z=1。以下语句的输出是_________?(请先正确缩进语句。) if (x > 0) if (y > 0) System.out.println("x > 0 and y > 0"); else if (z > 0) System.out.println("x < 0 and z > 0");

A. x > 0 and y > 0;
B. x < 0 and z > 0;
C. x < 0 and z < 0;
D. no output.

以下代码的输出是什么? int x = 0; while (x < 4) { x = x + 1; } System.out.println("x is " + x);

A. x is 0
B. x is 1
C. x is 3
D. x is 4

以下代码的输出结果是_________? int number = 6; while (number > 0) { number -= 3; System.out.print(number + " "); }

A. 60
B. 63
C. 30
D. 3 0 -3

答案查题题库