Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

According to the Java Language Specification, §11.1.1, "The Kinds of Exceptions" [JLS 2011],

The unchecked exceptions classes are the class RuntimeException and its subclasses, and the class Error and its subclasses. All other exception classes are checked exception classes.

...

In the event of actually running out of memory, it is likely that some program data will be in an inconsistent state. Consequently, it might be best to restart the process. If an attempt is made to carry on, reducing the number of threads, or just cycling them, may be a good idea because threads often leak memory.

The methods Thread.setUncaughtExceptionHandler() and ThreadGroup.uncaughtException() can be used to help deal with an OutOfMemoryError in threads.

Bibliography

[JLS 2011]§11.2, "Compile-Time Checking of Exceptions"
[Kalinovsky 2004]Chapter 16, "Intercepting Control Flow: Intercepting System Errors"

...