Computer Science 111:

Introduction to Computer Science I

Gregory M. Kapfhammer


creative commons licensed ( BY-NC-SA ) flickr photo shared by Ed Yourdon

Color Scheme

Key Concept

Corresponding Diagram

In-Class Discussion

In-Class Activity

Details in the Textbook

Exception Handling

What could go wrong?

File system problems

Network problems

Write a Java program that divides a variable by zero!

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

How are these types of exceptions similar and different?

Try-Catch Statements

Turn to pages 542 and 543

Pull from your share repository

Compile and run the ProductCodes example

Run the program using the textbook's examples

Try your own valid and banned codes

The exceptions are handled with catch blocks!

Any Questions?