9.3 The Class Hierarchy of Exceptions
An exception is an object whose type is directly or indirectly derived from java.lang.Throwable . (The naming with - able suggests an interface, but Throwable is a non-abstract class.) You’ll have direct little interaction with Throwable but rather will interact with the direct subclass Exception or the exception classes derived from Exception .
9.3.1 Members of the Exception Object
The exception object passed to you in the catch clause is rich with information. In this way, you can find out which exception is actually involved and what error message is called. The stack trace can also be queried and output, as in the following example:
try { Integer.parseInt( "19%" );}catch ( NumberFormatException ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access