Question: Consider the following code snippet: public void readFile ( String filename ) throws FileNotFoundException { File inFile = new File ( filename ) ; Scanner

Consider the following code snippet:
public void readFile(String filename) throws FileNotFoundException
{
File inFile = new File(filename);
Scanner in = new Scanner(inFile);
...
}
If the file cannot be located, which of the following statements about this code is correct?
Question 29 options:
It cannot be determined how the method must handle the exception if the file cannot be located.
This method must handle the exception in the body of the method.
This method will be terminated if the file cannot be located.
This method must use a throw statement to pass the error back to its caller.

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!