We have created a hierarchy of exceptions like below: A) The code written below throws an exception from the above hierarchy, depending on the value of c. Fill in the 5 gaps below, so that a correct working program is created. B) the following code throws two exceptions: Exception and ExceptionD. The exception name in the catch statement was removed as I expect you to recognize the order by which the exceptions are written in this code. B-1) what will be printed if the method is called by x = 0. B-2) what will be printed if the method is called by x = -1. B-3) what will be printed if the method is called by x = 1. C) A class called Exam is defined as below. Another class called TT2 extends class Exam and overrides all the three methods of Exam class. Specify what type of exceptions can be thrown by the methods that are defined in class TT2.
We have created a hierarchy of exceptions like below:
A) The code written below throws an exception from the above hierarchy, depending on the value of c.
Fill in the 5 gaps below, so that a correct working program is created.
B) the following code throws two exceptions: Exception and ExceptionD. The exception name in the catch statement was removed as I expect you to recognize the order by which the exceptions are written in this code.
B-1) what will be printed if the method is called by x = 0.
B-2) what will be printed if the method is called by x = -1.
B-3) what will be printed if the method is called by x = 1.
C) A class called Exam is defined as below.
Another class called TT2 extends class Exam and overrides all the three methods of Exam class. Specify what type of exceptions can be thrown by the methods that are defined in class TT2.
Step by step
Solved in 2 steps with 2 images