unchecked RuntimeException; considered evil

Check Exceptions

Unchecked Runtime Exceptions

java unchecked runtime exception RuntimeExceptions are inherently unsafe because Java does not require a catch or throws statement for them, they are unchecked. Unchecked RuntimeExceptions sidestep the java language features for Exception handling and are reserved for critical failures in the JVM or underlying platform which the application cannot reasonably be expected to handle. The compiler does not force a programmer using a class that throws Unchecked exception to handle them. Unchecked exceptions can propergate up the call stack and may never be caught when they may cause a critical failure of the program.

A checked Exception forces the programmer to either handle the Exception or propergate it. Checked Exception therefore allow for progess and graceful failure of the program. Checked Exceptions allow the programmer to prevent the program from crashing.


oo_java_checked_vs_unchecked.txt ยท Last modified: 2012/01/26 10:04 by Martin Spamer