Skip to content
Sharp

Exceptions · interview question

What happens if a method throws a checked exception that is not handled or declared?

Multiple choiceEasychapter-6-curatedpremiumexceptionschecked-vs-unchecked-exceptions
Choose one answer
Answer and explanation

Correct answer

D. The code will not compile.

Why

Checked exceptions must be either declared in the method's throws clause or caught within the method. Failing to do so results in a compile-time error, preventing the code from compiling.

Test yourself on Exceptions

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

Start free test
All Exceptions questions →