Create an exception hierarchy of ExceptionA, ExceptionB and ExceptionC such that ExceptionB inherits from ExceptionA and ExceptionC inherits from ExceptionB. Write a test program to show that the catch block for supertype exception (ExceptionA) can catch all the subtype ex- ceptions (ExceptionB and ExceptionC). Print out a message such as "ExceptionB caught" to indicate which type of exception is caught. Name your class file as ExceptionHierarchy.java.
Create an exception hierarchy of ExceptionA, ExceptionB and ExceptionC such that ExceptionB inherits from ExceptionA and ExceptionC inherits from ExceptionB. Write a test program to show that the catch block for supertype exception (ExceptionA) can catch all the subtype ex- ceptions (ExceptionB and ExceptionC). Print out a message such as "ExceptionB caught" to indicate which type of exception is caught. Name your class file as ExceptionHierarchy.java.
Chapter11: Exception Handling
Section: Chapter Questions
Problem 2CP
Related questions
Question
this is a java
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 6 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning