Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started