Given:
3. public class Main { 4. public static void main(String[] args) { 5. foreach:/*w w w .j av a2 s.co m*/ 6. for(int j=0; j<5; j++) { 7. for(int k=0; k< 3; k++) { 8. System.out.print(" " + j); 9. if(j==3 && k==1) break foreach; 10. if(j==0 || j==2) break; 11. } 12. } 13. } 14. }
What is the result?
C is correct.
A break breaks out of the current innermost loop and carries on.
A labeled break breaks out of and terminates the labeled loops.