BMIS 212 Week 7 Programming Assignment
Exercise 11.9 (Order of catch Blocks) Write a program that shows that the order of catch blocks is important. If you try to catch a superclass exception type before a subclass type, the compiler should generate errors.
Exercise 11.17 (Catching Exceptions with Superclasses) Use inheritance to create an exception superclass (called ExceptionA) and exception subclasses ExceptionB and ExceptionC, where ExceptionB inherits from ExceptionA and ExceptionC inherits from ExceptionB. Write a program to demonstrate that the catch block for type A ExceptionA catches exceptions of types ExceptionB and Exception C.
Exercise 11.18 (Catching Exceptions Using Class Exception) Write a program that demonstrates how various exceptions are caught with Catch
This time define classes ExceptionA (which inherits from class Exception) and ExceptionB (which inherits from class ExceptionA). In your program, create try blocks that throw exceptions of types ExeptionA, ExceptionB, NullPointerException and IO Exception. All exceptions should be caught with catch blocks specifying type Exception.