Java
Checked vs. Unchecked Exceptions
Difference between Exceptions
Imagine there are two types.
of potential problems ⚠️
in any construction project:
Foreseeable Risks and
Unforeseeable Accidents.
Checked Exceptions are the
Foreseeable Risks which the.
java compiler is able to detect.
Unchecked Exceptions are the
Unforeseeable accidents or.
programmer errors that are
produced while the JVM is
being run.
This is how differ the
Compiler VS Runtime Error.
Common Checked Exceptions
IOException, SQLException, FileNotFoundException, InterruptedException.
Common Unchecked Exceptions
NullPointerException, ArrayIndexOutOfBoundsException, ArithmeticException, ClassCastException.
🦕 Sources
- Oracle Java Documentation: The Catch and Specify Requirement (Checked vs Unchecked)
- Baeldung: Checked vs Unchecked Exceptions
- GeeksforGeeks: Checked and Unchecked Exceptions in Java