1. Create a class called \"Lab6Main\" 2. In main statement, prompt the user to i
ID: 3651690 • Letter: 1
Question
1. Create a class called "Lab6Main"2. In main statement, prompt the user to input an option. Four of these options call a respective method which causes an exception.
a. 1- Throw Exception A
b. 2- Throw Exception B
c. 3- Throw Exception C
d. 4- Throw My Custom Exception
3. Create three methods. Each method should throw a different exception (you may choose any three. For example: Arithmetic Exception). The exception should be caught using a try/catch block.
4. In your catch blocks, print the message and stack trace (check Throwable API)
5. Create a second class named "myCustomException" and add the constructor EmailAddress
6. Back in your Lab6Main class, create a fourth method which throws the "myCustomException" exception
Explanation / Answer
2.b. 2- Throw Exception B
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.