April 13
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.