About Question enthuware.ocajp.i.v7.2.1083 :
Posted: Wed Jan 29, 2014 3:20 pm
Hi, newbie here.
I was looking at question #85 on practice test #1:
Why is it that i increments every time executes? The label is after the for loop that would increment i?
Thanks for any insight.

Code: Select all
class LoopTest{
public static void main(String args[]) {
int counter = 0;
outer:
for (int i = 0; i < 3; i++) {
middle:
for (int j = 0; j < 3; j++) {
inner:
for (int k = 0; k < 3; k++) {
if (k - j > 0) {
break middle;
}
counter++;
}
}
}
System.out.println(counter);
}
}
Code: Select all
break middle;
Code: Select all
middle:
Thanks for any insight.