Break Statement In A Nested Loop
Consider the following code segment.
public class NestedBreak {
public static void main(String[] args) {
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
if(i == j) {
break;
}
System.out.print(i + "," + j + " ");
}
}
}
}
All of the following statements about the nested loops are true EXCEPT:
A
The inner loop executes fully for every iteration of the outer loop without interruption.
B
The break statement inside the inner loop causes premature termination when i equals j.
C
The behavior of the nested loops is influenced by both i and j, especially due to the break condition.
D
The code only prints pairs (i, j) when i is not equal to j until the break condition is met.
Question Leaderboard
Not enough data yet to show leaderboard.
