Checked Exceptions vs Unchecked Exceptions/ Runtime Exceptions - Coded Java

Latest

Quality & Simple Java Content

Sep 23, 2018

Checked Exceptions vs Unchecked Exceptions/ Runtime Exceptions

Checked Exceptions


"Use checked exceptions for recoverable conditions and run-time exceptions for 
programming errors."

Checked Exceptions
Exceptions that are evaluated at compile time. The simple rule of thumb is, if a method code is referring an another code that throws an exception, either it should handle it using Try/ Catch block or throw it.

Unchecked Exceptions
Unchecked exceptions are the exceptions that are not evaluated at compile time. It means it is not enforced to handle them. 

Run Time Exceptions
Run time Exceptions along with Error are unchecked exceptions in Java.

References



No comments:

Post a Comment