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
Q93: Which of the following statements about exception
Q94: In the hierarchy of Exception classes, the
Q95: An example of a fatal error that
Q96: If the current method in a program
Q97: Consider the following code snippet: public double[]
Q99: Which of the following statements about the
Q100: Which of the following statements about exception
Q101: Consider the following code snippet: try
{
PrintWriter outputFile
Q102: Insert the missing code in the following
Q103: Insert the missing code in the following
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