Skip to content
Sharp

Core Java · interview question

In Java, what is the purpose of the 'throws' keyword in a method declaration?

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

Correct answer

C. To indicate that a method may throw a specific exception.

Why

The 'throws' keyword is used in method declarations to indicate that the method may throw certain exceptions, allowing callers to be aware of and handle those exceptions.

Test yourself on Core Java

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

Start free test
All Core Java questions →