Question: Part #l: Build a class called TestExceptionsjaya. Put the following code in the main method. int maxAd IPART I This line will cause an exception

Part #l: Build a class called "TestExceptionsjaya". Put the following code in the main method.
int maxAd
IPART I This line will cause an exception to be thrown, you need to add a catch to catch this exception(ArithmeticException)
UPART II, remove the z=yz; line and the PART II line will now cause a different exception to be thrown that you also need to catch(ArravoutofBoundsException)
a.) Compile and run this class with no try/catch block. What happens?
b.) Now add try/catch blocks to catch these exceptions?
Do part I and part II.
c.) Is there another way that you can prevent a run-time error without using try-catch blocks?
 Part #l: Build a class called "TestExceptionsjaya". Put the following code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!