Skip to content
Sharp

Exceptions · interview question

When designing a Java API, how should exceptions be documented?

Multiple choiceMediumchapter-6-curatedpremiumexceptionsreliable-java-error-design
Choose one answer
Answer and explanation

Correct answer

A. In the Javadoc comments with @throws or @exception tags.

Why

Documenting exceptions with Javadoc using @throws or @exception tags helps developers understand what exceptions a method might throw, aiding in proper use and handling of the API.

Test yourself on Exceptions

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

Start free test
All Exceptions questions →