Skip to content
Sharp

Exceptions · interview question

Why does the 'throws' keyword in a method declaration matter in practice?

Multiple choiceEasychapter-6-curatedpremiumexceptionscustom-exceptions
Choose one answer
Answer and explanation

Correct answer

D. To indicate that the method may throw certain exceptions.

Why

The 'throws' keyword in a method declaration specifies the exceptions that the method might throw, allowing the caller to handle them appropriately.

Test yourself on Exceptions

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

Start free test
All Exceptions questions →