7.1.2 Errors, Exceptions and the class Throwable

Apart from exceptions, there are also objects of the Error class. These Errors are thrown when problems arise with the consistency of the Java Virtual Machine. A typical error arises when a class file is corrupted or deleted after the compilation to bytecodes. You will encounter then a ClassFormatError or a NoClassDefFoundError.

Both exceptions and errors are subclasses of the class Throwable. Only objects of this class can be thrown and caught by the java keywords throw, and try & catch. The Throwable class comes with messages, notably getMessage() and printStackTrace().