Given:
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
0
B.
0
1
2
0
1
2
C.
0
1
2
3
0
1
2
3
D.
Compilation fails
Compilation fails
Risposta : B
Infatti si entra la prima volta dentro il do while. Dentro viene eseguito l'while per 3 volte e poi si esce dal while e subito wopo anche dal do while.
Riferimenti :
Nessun commento:
Posta un commento