Bird
0
0

Which block is guaranteed to execute whether an exception occurs or not in a try block?

easy📝 Conceptual Q2 of 15
Java - Exception Handling
Which block is guaranteed to execute whether an exception occurs or not in a try block?
AThe <code>catch</code> block
BThe <code>finally</code> block
CThe <code>try</code> block
DThe <code>throw</code> block
Step-by-Step Solution
Solution:
  1. Step 1: Identify the role of finally block

    The finally block always executes after try and catch, regardless of exceptions.
  2. Step 2: Confirm other blocks behavior

    catch runs only if an exception occurs; try runs first; throw is a statement, not a block.
  3. Final Answer:

    The finally block -> Option B
  4. Quick Check:

    finally always runs = The finally block [OK]
Quick Trick: finally always runs after try/catch [OK]
Common Mistakes:
  • Confusing catch as always running
  • Thinking try runs after catch
  • Misunderstanding throw as a block

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes