The main difference between checked and unchecked exception is that the checked exceptions are checked at compile-time while unchecked exceptions are checked at runtime.
Checked Exceptions:- Exceptions that checked at compile time that are called checked exceptions. As per Exception hierarchy all classes that extends Exception class except UncheckedException comes under checked exception.
There are following checked Exception:-
- Exception
- IOException
- EOFException
- FileNotFoundExceptio
- ParseException
- ClassNotFoundException
- CloneNotSupportedException
- InstantiationException
- InterruptedException
- NoSuchMethodException
- NoSuchFieldException
UnChecked Exceptions:- Exceptions that are not checked at the compile time that are called unchecked exceptions. Classes that extends RuntimeException comes under unchecked exceptions.
There are following Unchecked Exception:-
- ArrayStoreException
- IllegalArgumentException
- IllegalMonitorStateException
- IllegalPathStateException
- IllegalStateException
- NullPointerException
- NoSuchElementException
- BufferOverflowException
- BufferUnderflowException
- CannotRedoException
- CannotUndoException
- ClassCastException
- CMMException
- ConcurrentModificationException
- DOMException
- EmptyStackException
- ImagingOpException
- IndexOutOfBoundsException
- MissingResourceException
- NegativeArraySizeException