Question: Exercise 1 Create a file named A9.java. Place all your code in this file. Write a static method in the public class A9 named readSecondLine

 Exercise 1 Create a file named A9.java. Place all your code

Exercise 1 Create a file named A9.java. Place all your code in this file. Write a static method in the public class A9 named readSecondLine that takes as input a String path and returns a String. Your method should read from the file at the specified path and start reading line by line. It should return the second line. Note: You must still close your file! There are two ways to ensure you close your file after returning. 1) Try with resources 2) Close the file in the finally finally is called even if you return inside the try. Note: When a method fails to return the correct object, you can return null at the end

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!