Personal tools
You are here: Home Classes Fall 2004 - Spring 2005 CS 150 4.13.05 April 13
Document Actions

April 13

by admin last modified 2005-05-11 13:34

Examples from April 13

Today we did some examples of exception throwing and catching. All of these ask the user to enter two numbers a and b; the program responds with the quotient a/b. There is a problem when b is 0.

TestException1 and SimpleInput.java: This throws an exception on division by 0. The exception isn't caught and the program crashes.

TestException2 and SimpleInput.java: This is just like TestException1, only the exception is caught and the program continues.

TestException3 and SimpleInput.java: This time the system throws an exception on division by 0. It isn't caught and the program crashes.

TestException4 and SimpleInput.java: This is just like TestException3, only the exception is caught.

 

 

 

 

 

 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: