previous |
start |
next .... [Slide 28] ....
Checked and Unchecked Exceptions
- Compiler tracks only checked exceptions
- NullPointerException is not checked
- IOException is checked
- Generally, checked exceptions are thrown for reasons beyond the
programmer's control
- Two approaches for dealing with checked exceptions
- Declare the exception in the method header (preferred)
- Catch the exception
previous |
start |
next .... [Slide 28] ....