Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago