In Java programming, for every occurrence of an exception, there generates an exception object, which holds all the details of the exception. Then the program searches for its respective exception handler. If found, the exception is handled or resolved, or else the program execution stops.

Java generates two types of exceptions. These are:

  1. Checked exception
  2. Unchecked exception

Difference Between Checked and Unchecked Exceptions in Java

Checked Exception Unchecked Exception
Checked exceptions occur at compile time. Unchecked exceptions occur at runtime.
The compiler checks a checked exception. The compiler does not check these types of exceptions.
These types of exceptions can be handled at the time of compilation. These types of exceptions cannot be a catch or handle at the time of compilation, because they get generated by the mistakes in the program.
They are the sub-class of the exception class. They are runtime exceptions and hence are not a part of the Exception class.
Here, the JVM needs the exception to catch and handle. Here, the JVM does not require the exception to catch and handle.
Examples of Checked exceptions:
  • File Not Found Exception
  • No Such Field Exception
  • Interrupted Exception
  • No Such Method Exception
  • Class Not Found Exception
Examples of Unchecked Exceptions:
  • No Such Element Exception
  • Undeclared Throwable Exception
  • Empty Stack Exception
  • Arithmetic Exception
  • Null Pointer Exception
  • Array Index Out of Bounds Exception
  • Security Exception

Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram