Java Reference
In-Depth Information
11
Exception Handling:
A Deeper Look
It is common sense to take a
method and try it. If it fails,
admit it frankly and try
another. But above all, try
something.
—Franklin Delano Roosevelt
O! throw away the
worser part of it,
And live the purer
with the other half.
—William Shakespeare
If they're running and they don't
look where they're going
I have to come out from
somewhere and catch them.
—Jerome David Salinger
Objectives
In this chapter you'll:
Learn what exceptions are
and how they're handled.
Learn when to use exception
handling.
Use try blocks to delimit
code in which exceptions
might occur.
Use throw to indicate a
problem.
Use catch blocks to specify
exception handlers.
Use the finally block to
release resources.
Understand the exception
class hierarchy.
Create user-defined
exceptions.
 
 
Search WWH ::




Custom Search