Difficulty: Easy
Correct Answer: BCD
Explanation:
Introduction / Context:This reinforces exception handling flow: code after a throw is skipped, the matching catch runs, finally runs, and then execution continues after try-catch-finally.
Given Data / Assumptions:
Concept / Approach:Throwing RuntimeException transfers control directly to catch. finally executes regardless, and execution then resumes after the try-catch-finally.
Step-by-Step Solution:
badMethod throws RuntimeException; "A" is not printed.catch (Exception) prints "B".finally prints "C".After the block, "D" prints.Verification / Alternative check:Remove the throw to see "A" followed by "C" and then "D".
Why Other Options Are Wrong:They omit one or more required letters or assume "A" prints, which it does not.
Common Pitfalls:Forgetting that finally runs even after a handled exception; and believing execution stops after catch (it continues).
Final Answer:BCD
Discussion & Comments