The Java programming language provides three kinds of throwables:
- checked exceptions
- use checked exceptions for conditions from which the caller can reasonably be expected to recover
- runtime exceptions (unchecked exceptions)
- Use runtime exceptions to indicate programming errors
- all of the unchecked throwables you implement should subclass RuntimeException
Checked vs Unchecked Exceptions
- Checked exceptions must be explicitly caught or propagated as described in Basic try-catch-finally Exception Handling.
- Unchecked exceptions do not have this requirement. They don't have to be caught or declared thrown.
- Checked exceptions in Java extend the java.lang.Exception class.
- Unchecked exceptions extend the java.lang.RuntimeException.