Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me code the following in JAVA TestExceptions class: 1. Simple exception handling a. Download the following file from the class website: TestExceptions.java b.
Please help me code the following in JAVA
TestExceptions class:
1. Simple exception handling a. Download the following file from the class website: TestExceptions.java b. Compile the code and notice the compilation error message. c. Modify the main0 method to propagate the IOException (this is an ancestor of FileNotFoundException). This is done using a throws clause when the method is first declared. While there are multiple exceptions that might be thrown by this code, this change should propagate all of them, since they all inherit from IOException Execute the program and notice the run-time error. Modify the code to handle the exceptions using a try-catch block instead of propagating the exception. When the exception occurs print: "The file you have requested cannot be found. Test your changes. d. e. f. gStep 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