Skip to content
Sharp

Core Java · interview question

Why does the 'finally' block in a try-catch-finally statement matter in this design?

Multiple choiceEasychapter-6-curatedpremiumcore-javacode-reading-with-exceptions
Choose one answer
Answer and explanation

Correct answer

B. To execute code regardless of whether an exception is thrown.

Why

The 'finally' block is used to execute code that should run regardless of whether an exception is thrown, such as cleanup activities.

Test yourself on Core Java

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

Start free test
All Core Java questions →