J.V · Java 25 practice question
A developer wants to define a custom exception type representing a recoverable failure in a file-parsing service. Which direct subclass of Throwable is designated as the superclass for exceptions from which ordinary programs may wish to recover?
Check answer and explanation
Correct answer: Exception
Explanation
Exception is the direct subclass of Throwable that serves as the superclass for all exceptions from which ordinary programs may want to recover.
Common trap
Error is a direct subclass of Throwable, but it is reserved for abnormal conditions that ordinary programs are not expected to recover from. Object is the superclass of Throwable, not a subclass of Throwable.
Source: JLS SE 25 §11.1.1. The Kinds of Exceptions
Checked against the cited text on 2026-11-25.