
11.9 Chapter Summary 797
CHAPTER SUMMARY
11.9 Chapter Summary
■
Java provides exception classes so that unexpected, illegal opera-
tions at run time can be trapped and handled. This provides the
programmer with a tool to keep the program running instead of
terminating.
■
When calling a constructor or method that throws a checked
exception, you must use try and catch blocks; otherwise, the code
will not compile.
■
For calls to a constructor or method that throws an unchecked
exception, try and catch blocks are optional. If try and catch blocks
are not used, the exception will be caught at run time by the Java
Virtual Machine.
■
When a try block assigns a value ...