Hello I am studying for the 1Z0-803 (Oracle Certified Associate, Java SE 7 Programmer) exam and I have the hardest time with following the flow of nested loops. On practice tests I do ok on more complex concepts like polymorphism but I miss over half of question with nested loops. For example:
outer:
for(int i=0; i<3; i++) {
for(int j=0; j<2; j++) {
if(i == j){continue outer;}
System.out.println("i=" + i + " , j=" + j);
}
}
I know this outputs
i=1 , j=0
i=2 , j=0
i=3 , j=1
I know this from reading the explanation after getting it wrong. What I am not getting is how is j = 0?
I know this is really simple but I keep missing nested loops especial with labels so any help or advice as to how to approach solving these problems while taking the exam would be greatly appreciated.