- Exceptions are the objects representing the logical errors that occur at run time and makes JVM enters into the state of "ambiguity".
- The objects which are automatically created by the JVM for representing these run time errors are known as Exceptions.
- 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.
- few of the subclasses of
AnnotationFormatError- Thrown when the annotation parser attempts to read an annotation from a class file and determines that the annotation is malformed.
AssertionError- Thrown to indicate that an assertion has failed.
LinkageError- Subclasses of LinkageError indicate that a class has some dependency on another class; however, the latter class has incompatibly changed after the compilation of the former class.
VirtualMachineError- Thrown to indicate that the Java Virtual Machine is broken or has run out of resources necessary for it to continue operating.
- There are really three important subcategories of
Error- Something severe enough has gone wrong the most applications should crash rather than try to handle the problem,
- Unchecked Exception (aka
RuntimeException) - Very often a programming error such as a
NullPointerExceptionor an illegal argument. Applications can sometimes handle or recover from this
Throwablecategory -- or at least catch it at the Thread's
run()method, log the complaint, and continue running.
- Checked Exception (aka Everything else) - Applications are expected
to be able to catch and meaningfully do something with the rest, such as