30 December 2010

A Question on Java Exception?

In Java, there are two types of exceptions - checked and unchecked.
Java compiler ensures that "checked" exceptions are handled and flags compilation error when checked exceptions are not handled. But it does not flag errors when "unchecked" exceptions are not handled. The subclasses of "RuntimeException" and the subclasses "Error" are "unchecked".

Why does Java have this as a thumb rule?