Question: The program defined in the Trouble.java file randomly crashes with one of three types of exception, or runs to completion if no exception occurs. Modify


The program defined in the "Trouble.java" file randomly crashes with one of three types of exception, or runs to completion if no exception occurs. Modify this program's main() method (using exception-handling) so that the program behaves as follows: * If calling problem() produces an ArrayIndexOutOfBoundsException, print "Alpha". If calling problem() produces a NullPointerException, print "Beta". *If calling problem) produces an ArithmeticException, print "Gamma". *Otherwise, if problem() does not produce any type of exception, print "Delta" Your program should print exactly one of these four words each time it is executed (e.g., "Alpha" or "Delta", but not "Alpha" AND "Delta"). Do not make ANY changes to the problem() method; your solution should ONLY change main() for this exercise
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
