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 exceptionArithmeticException
UPART II remove the ; line and the PART II line will now cause a different exception to be thrown that you also need to catchArravoutofBoundsException
a Compile and run this class with no trycatch block. What happens?
b Now add trycatch blocks to catch these exceptions?
Do part I and part II
c Is there another way that you can prevent a runtime error without using trycatch blocks?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
