Originally posted by Nayanjyoti Talukdar:
CheckedException-> The exceptions which can be handled by the programmer. In some scenarios, programmer can anticipate the type of exceptions that can be thrown from the application. As for example, whenever we do file operation, we know that it might throw FileNotFoundException if it can't locate the particular file.
UncheckedException-> The exceptions which can't be handled by the programmer, those are Unchecked exceptions. All unchecked exceptions are subclass of RuntimeException. These exceptions are ususally hadled by JVM. Programmer don't have control over these exceptions, so JVM takes care of that.
Sorry Nayan, but I don't like your definition.
A checked exception means that the
[compiler enforces that the code must be placed in a try/catch block or the method must declare that it throws the exception.
An unchecked exception is a RuntimeException or any subclass of RuntimeException and the compiler does not
force the programmer to explicitly handle them. However, the programmer can still definitely handle an unchecked exception. For example, ArithmeticException is an unchecked exception because it extends RuntimeException, so you can get away with this:
But to handle that unchecked exception (division by 0) you could do this: