Skip to content
Sharp

Exceptions · interview question

In which scenario does a 'finally' block execute?

Multiple choiceEasychapter-6-curatedpremiumexceptionstry-catch-finally
Choose one answer
Answer and explanation

Correct answer

B. Always, unless System.exit() is called

Why

A 'finally' block is executed regardless of whether an exception is thrown or not, except if System.exit() is called before reaching 'finally'. It guarantees cleanup actions.

Test yourself on Exceptions

A free test with instant, explained results. No account needed.

Start free test
All Exceptions questions →