Difficulty: Medium
Correct Answer: Compilation fails.
Explanation:
Introduction / Context:
This question examines labeled break behavior and whether the provided snippet, as written, is syntactically complete. A labeled break can exit an outer loop immediately; however, you must also consider code structure and braces.
Given Data / Assumptions:
Concept / Approach:
As-is, the snippet has unbalanced braces and thus will not compile. If we conceptually repair the braces, the labeled break would trigger before the println executes, because the inner loop’s condition i > --j eventually becomes true and exits the outer loop immediately, bypassing the print inside the outer loop. But the MCQ asks about the given code, not a corrected version.
Step-by-Step (if it were complete):
Why Other Options Are Wrong for the given snippet:
Common Pitfalls:
Ignoring brace balance in snippets and focusing only on logic. Real Java source must be well-formed to compile.
Final Answer:
Compilation fails.
Discussion & Comments