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?
A) This method must handle the exception in the body of the method.
B) This method will be terminated if the file cannot be located.
C) This method must use a throw statement to pass the error back to its caller.
D) It cannot be determined how the method must handle the exception if the file cannot be located.
Correct Answer:
Verified
Q81: When a program throws an exception within
Q83: When writing a method, which of the
Q87: The Java compiler requires that your program
Q88: Consider the following code snippet: PrintWriter outputFile
Q89: Which of the following code snippets about
Q92: Which of the following statements about checked
Q93: Consider the following code snippet:
Public double[] readInputFile(String
Q95: An example of a fatal error that
Q97: Consider the following code snippet written in
Q99: Which of the following statements about the
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents