javaexceptionthrowable

Differences between Exception and Error


I'm trying to learn more about basic Java and the different types of Throwables, can someone let me know the differences between Exceptions and Errors?


Solution

  • Errors should not be caught or handled (except in the rarest of cases). Exceptions are the bread and butter of exception handling. The Javadoc explains it well:

    An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.

    Look at a few of the subclasses of Error, taking some of their JavaDoc comments:

    There are really three important subcategories of Throwable: