Given:
public class DoCompare4 {
public static void main(String[] args) {
String[] table = {"aa", "bb", "cc"};
int ii =0;
do
while (ii < table.length)
System.out.println(ii++);
while (ii < table.length);
}
What is the result?
A.
0
B.
0
12
C.
0
12012012
D.
Compilation fails
Explanation:
table.length is 3. So the do-while loop will run 3 times with ii=0, ii=1 and ii=2.
The second while statement will break the do-loop when ii = 3.
Note: The Java programming language provides a do-while statement, which can be expressed as follows:
do {
statement(s)
} while (expression);
this test don´t work, I failed the test, Don´t lost your time. Only 5 quest are in the test
need to remove line 8.