Question: Please help me code the following in JAVA 3. Handling exceptions with a finally clause a. Download the following file from the class website: TestFinally.java

Please help me code the following in JAVA

Please help me code the following in JAVA 3. Handling exceptions witha finally clause a. Download the following file from the class website:TestFinally.java b. Examine the code to determine what it does C. Compile

3. Handling exceptions with a finally clause a. Download the following file from the class website: TestFinally.java b. Examine the code to determine what it does C. Compile the code and notice the error d. Modify TestFinally java to handle the exception following these instructions (and those embedded in the code): i. ii. Embedded in the code is a note showing the location for the try statement. The first line of the catch block should look like this: catch(IOException e) { Display a meaningful error message to indicate the error that has occurred and include the following statement in your catch clause: iii. System.out.println("The exception is:"e); may be clean-up activities that are required before the method or program terminates. In this case, any open files should be closed prior to terminating the program Include a finally block that closes the files using notes 4 and 5 in the code that show where to place the beginning and end of the block. You will need to add a try-catch block inside the finally block to handle any IOExceptions associated with the file close operation. v. vi. Test your code. When it is working, you will generate another type of exception. Add a second catch clause inside the finally block with a meaningful message to handle this new exception. e. f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!