Labelled break and continue in nested loops
QuizMediumJava onlyAsked in: TCS, Wipro
What does this print?
outer:
for (int r = 1; r <= 3; r++) {
for (int c = 1; c <= 3; c++) {
if (c == 2) continue outer;
if (r == 3) break outer;
System.out.print(r + "" + c + " ");
}
}11 2111 21 3111 13 21 2311
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.