Lecture 19 Objectives
At the end of today's class you should
KNOW:
- That the way to handle error or abnormal situations in a Java program
is to throw an exception
- That when an exception is thrown, other methods are alerted, and are
given an opportunity to recover
- That Java has an Exception class that defines many different kinds of exceptions
- That programmers can define their own kinds of exceptions as subclasses of Exception
- The difference between checked and unchecked exceptions
- That checked exceptions must be either declared or caught
BE ABLE TO:
- Create an exception class
- Declare that a method throws an exception
- Use a try...catch block to catch exceptions
Sample Exam Question:
In a short paragraph, explain the difference between declaring and catching a checked exception. What is the programmer's responsibility in each case?