Checked Vs Unchecked Exceptions in Java
In java there are two type of exceptions are generated. i.e.
Checked Exception
- Occur at compile time.
- Also known as Compile Time Exception.
- Checked by the compiler.
- Handled during the time of compilation.
- JVM needs the exception to be catch or handle.
- Shows recoverable conditions.
Examples of Checked Exceptions
- File Not Found Exception
- No Such Field Exception
- Interrupted Exception
- No Such Method Exception
- Class Not Found Exception
Unchecked Exception
- Occur at runtime.
- Also known as Run Time Exception.
- Unchecked by the compiler.
- Exceptions cannot be a catch or handle during time of compilation.
- These exceptions are not a part of the Exception class.
- JVM does not needs the exception to be catch or handle.
- Shows programming errors.
0 Comments