Hi, Andrew.
Here are the steps the code in your first example goes through:
1. You enter the "outer" loop in line 5, and go on to line 6.
2. i initializes to 0 in line 6.
3. j initializes to 0 in line 8.
4.
Java executes the
test in the "if" statement on line 10. Since i does equal j, we continue outer, which advances i from 0 to 1 at line 6.
5. At line 8, we're starting over in a new j loop, so j is once again initialized to 0.
6. The test at line 10 fails, so we
don't continue this time. Instead, we print output: i = 1, j = 0.
7. Since we're at the end of the inner for loop (j) and we've no reason to leave it, j advances in line 8 from 0 to 1.
8. i still equals 1, and j equals 1. The test in line 10 evaluates to TRUE, so we once again continue outer, which advances i from 1 to 2 on line 6.
9. Since the condition i > 2 evaluates fall, the outer for loop, and the program, terminates.
Looking over what's been printed to the screen, Andrew, only one line has been: i = 1, j = 0.
You can follow similar step-by-step logic to analyze the second example, keeping in mind that "continue" without the label refers to the innermost loop.
Good luck,
Art