Differences between checked and Unchecked exceptions in java?

Unchecked ExceptionChecked Exception
All the subclasses of RuntimeException are called unchecked exception.All subclasses of Throwable class except RuntimeException are called as checked exceptions
Unchecked exceptions need not be handled at compile time as These exceptions arise mostly due to coding mistakes in our program.Checked Exceptions need to be handled at compile
time.
Here, the JVM does not require the exception to catch and handle.Here, the JVM needs the exception to catch and handle.
Example-ArrayIndexOutOfBoundsException, ClassCastException, IndexOutOfBoundExceptionSqlException,
FileNotFoundException,ClassNotFoundException
Unchecked Vs Checked Exception in Java

Posted

in

Tags:

Comments

Leave a Reply