题目内容

以下哪条语句表示“如果radius为正,则显示圆的面积”?

A. if (radius != 0) System.out.println(radius * radius * 3.14);
B. if (radius >= 0) System.out.println(radius * radius * 3.14);
C. if (radius > 0) System.out.println(radius * radius * 3.14);
D. if (radius <= 0) System.out.println(radius * radius * 3.14);

查看答案
更多问题

假设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

答案查题题库