Java Reference
In-Depth Information
9.1
Exception Handling Basics
519
Example: A Toy Example of Exception Handling
519
9
Mechanism
524
try-throw-catch
Exception Classes
528
Exception Classes from Standard Packages
529
Defining Exception Classes
531
Multiple
Blocks
542
catch
9.2
Throwing Exceptions in Methods
546
Throwing an Exception in a Method
547
Exception Handling
Declaring Exceptions in a
Clause
549
throws
Exceptions to the Catch or Declare Rule
551
Clause in Derived Classes
553
throws
When to Use Exceptions
553
★
Event-Driven Programming
555
9.3
More Programming Techniques
for Exception Handling
556
★
The
Block
557
finally
★
Rethrowing an Exception
559
★
The
Class
559
AssertionError
Exception Handling with the
Scanner
Class
559
562
ArrayIndexOutOfBoundsException
Chapter Summary
562
Answers to Self-Test Exercises
563
Programming Projects
567