FOR MORE CLASSES VISIT www. tutorialoutlet. com
Write a program that demonstrates causing and throwing the following exceptions
FOR MORE CLASSES VISIT www. tutorialoutlet. com
Java: Write a program that demonstrates causing and throwing the following exceptions. ArithmeticException InputMismatchException( User input permitted) ArrayIndexOutOfBoundsException StringIndexOutOfBoundsException( Optional. See chapter 14 if you want to try) NullPointerException NegativeArraySizeException The program should present the user with a numbered menu that extends the capability to the user to select one of the above exceptions. Menu selection is run through a switch / case structure with each case associated with one of the exceptions being demonstrated / thrown. The entire switch / case structure should be contained within a single try block. Each case should contain code that creates the condition that causes the exception for that particular case to be thrown. After the single try block should be the multiple catch blocks for each type of exception with each catch block outputting a message that indicates the type of exception thrown and the values and / or condition( s) causing the exception. The last catch block should be followed by a finally block that outputs a message that indicates that the finally block was reached. Do not prompt the user for any input, except for the InputMismatchException, other than menu item number. Use hard coded literal values for data required for variables and member variables, class constructor calls, and other program variables. Your program( s) must include a description of what user is being prompted for each input.---------------------------------------------------------------------------------------