题目内容

Analyze the following code.int x = 1;while (0 < x) && (x < 100)System.out.println(x++);

A. The code does not compile because (0 < x) && (x < 100) is not enclosed in a pair of parentheses.
B. The numbers 2 to 100 are displayeD.
C. The code does not compile because the loop body is not in the braces.
D. The numbers 1 to 99 are displayeD.

查看答案
更多问题

What is the output of the following fragment?int i = 1;int j = 1;while (i < 5) {i++;j = j * 2;} System.out.println(j);

A. 64
B. 32
C. 16
D. 8

How many times will the following code print "Welcome to Java"?int count = 0;while (count++ < 10) {System.out.println("Welcome to Java");}

A. 9
B. 0
C. 10
D. 11

How many times will the following code print "Welcome to Java"?int count = 0;do {System.out.println("Welcome to Java");} while (++count < 10);

A. 10
B. 9
C. 11
D. 0

What is the value in count after the following loop is executed?int count = 0;do {System.out.println("Welcome to Java");} while (count++ < 9);System.out.println(count);

A. 0
B. 8
C. 9
D. 10

答案查题题库