411 REFERENCE · Wikibooks
Introduction to Programming Languages/Throwable classes
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
The Exception Hierarchy
All exceptions derive from Throwable.
Simplified hierarchy:
Object
|
Throwable
|
|---- Error
|
|---- Exception
|
|---- RuntimeException
Throwable
Base class of everything that can be thrown using throw.
Error
Represents severe system errors.
Examples:
OutOfMemoryError
StackOverflowError
Usually:
should not be handled;
indicate serious environment failures.
Exception
Represents ordinary application errors.
These are errors that:
may happen;
may be handled;
may allow recovery.
RuntimeException
Represents common runtime errors.
Examples:
division by zero;
invalid access;
null pointer.
They are generally caused by programming bugs.