Computer Science 100

Computational Expression

Gregory M. Kapfhammer

flickr photo by shared under a CC (BY) license

Color Scheme

Key Concept

Corresponding Diagram

In-Class Discussion

In-Class Activity

Details in the Textbook

Exception Handling

In Chapter 11?

What could go wrong?

What could go wrong with software?

File system problems

Network problems

Program that divides a variable by zero

What will this program do when executed?

Why is this behavior acceptable?

How to Handle?

Do not handle the exception

Handle the exception where it occurs

Handle the exception somewhere else in the program

What are the trade-offs of these solutions?

Uncaught exceptions

Caught Exceptions

Types of exceptions similar and different?

Try-Catch Statements

Finally Clauses

Turn to pages 506 and 507

Valid and invalid (banned) codes



The exceptions are handled with catch blocks!

The Exception Class Hierarchy

See Figure 11.1 on page 513

Review the TestData program

What is the purpose of the IOException?

What happens if a file is not available?

Any questions about exceptions?