Java Reference
In-Depth Information
9
Exceptions, Threads, and
Garbage Collectors
In This Chapter
Exception Class Hierarchy
Creating Exceptions
Using Exceptions
Exception-Processing Suggestions
Exception-Processing Summary
Threads
Inheriting from Thread
Implementing Runnable
Synchronization
Benefits and Cautions
Garbage Collection
Exercises: Java's Exceptions and Threads
Reviewing the Exercises
Proper error handling is a feature found in every well-designed system. A good sys-
tem not only checks for and reports the obvious errors, but it also plans for and
properly manages the unexpected errors. The general rules for good error handling
in any language might be stated this way:
Make sure to check for all possible error conditions.
If your program can handle the error properly (for example, ask the operator
for correction or assume a default processing condition), then do so.
If your program cannot handle the error, then report the error to the calling
program as an error condition as soon as possible.
219
Search WWH ::




Custom Search