Question: Part A: Become familiar with the Java API exception handling classes. .Create a new java project and add a class called StrTester. Add a main



Part A: Become familiar with the Java API exception handling classes. .Create a new java project and add a class called StrTester. Add a main method. For part A of this exercise, you will be writing code in a main method to intentionally throw the following runtime exceptions 1. ArithmeticException 2. NumberFormatException (extends from llegalArgumentException) 3. ArraylndexOutOfBoundsException (extends from IndexOutOfBoundsException) 4. NegativeArraySizeException 5. InputMismatchException (extends from NoSuchElementException) 6. NullPointerException 7. And one Error OutOfMemoryError public static void main(String[] args) Scanner scan new Scanner(System.in) System.out.print('Enter an integer: ") int x scan.nextInt0: int result0; Enter an integer: O Exception in thread "main" java lang ArithmeticException: /by zero at week9.Str Tester main(Str Tester.java:16) result 5/x; System.outprintln("result" result): Part A: Become familiar with the Java API exception handling classes. .Create a new java project and add a class called StrTester. Add a main method. For part A of this exercise, you will be writing code in a main method to intentionally throw the following runtime exceptions 1. ArithmeticException 2. NumberFormatException (extends from llegalArgumentException) 3. ArraylndexOutOfBoundsException (extends from IndexOutOfBoundsException) 4. NegativeArraySizeException 5. InputMismatchException (extends from NoSuchElementException) 6. NullPointerException 7. And one Error OutOfMemoryError public static void main(String[] args) Scanner scan new Scanner(System.in) System.out.print('Enter an integer: ") int x scan.nextInt0: int result0; Enter an integer: O Exception in thread "main" java lang ArithmeticException: /by zero at week9.Str Tester main(Str Tester.java:16) result 5/x; System.outprintln("result" result)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
