| Exception Handling |
| |
| Some Terminology |
| |
| Exception handling can be viewed as a nonlocal control structure. |
| When a method throws an exception, its caller must
determine whether it can catch the exception. |
| If the calling method can catch the exception, it takes over
and execution continues in the caller. |
| |
| Java exceptions are class objects subclassed from java.lang.Throwable.
Because exceptions are class objects, they can contain both data and methods.
In fact, the base class Throwable implements a method that returns a
String describing the error that caused the exception. This is useful
for debugging and if we want to give users a meaningful error message. |
| |
| |
| |
|
|
| |
| |