difference b/w Unchecked and checked Exception
Printable View
difference b/w Unchecked and checked Exception
Checked exception is an exception that you have to handle in your program.
EG: IOException
Unchecked exceptions are not required to be handled in the program
EG: NullPointerException
Checked Exceptions are checked by the compiler during the compile time so if you have not handled (using try/catch or throws) the checked exception you wud not be able to complie the class. Ex:IOException
Unchecked exceptions are the exception that are not checked by the complier and will be thrown only at run time by the JVM itself for ex: NullPointerException, ArrayIndexOutOfBounds exception
-hope it helps.
The exceptions which occur outside try block and remain undetected are known as unchecked exceptions.If such kind of exception occurs then the function containing the exception gets terminated immediately by calling abort() function.