I thought I was confident in figuring out loops, however, if anyone could give me some clarification as to their
pattern, it would be greatly appreciated. Take this sample (MindQ):
30. Consider the code fragment below:
outer: for( int i = 1; i <3; i++ )
{ inner: for( j = 1; j < 3; j++ )
{ if( j==2 )
continue outer;
System.out.println( "i = " +i ", j = " + j );
}
}
Which of the following would be printed to standard output?
a) i = 1, j = 1
b) i = 1, j = 2
c) i = 1, j = 3
d) i = 2, j = 1
e) i = 2, j = 2
f) i = 2, j = 3
g) i = 3, j = 1
h) i = 3, j = 2 I think the answer is a, b,..but I always get confused at this point -
does i (after continue outer) start back at 1, or does it carry on from where it left off, being 2?