Insert the missing code in the following code fragment. This code is intended to open a file and handle the situation where the file cannot be found.
Public void String readFile() throws IOException
{
File inputFile = new File(. . .) ;
Scanner in = new Scanner(inputFile) ;
Try
{
While (in.hasNext() )
{
) . .
}
}
Finally
{
___________________
}
}
A) catch (IOException exception)
B) catch (FileNotFound exception)
C) catch (IllegalArgumentException exception)
D) in.close()
Correct Answer:
Verified
Q81: Consider the following code snippet:
Try
{
PrintWriter outputFile =
Q81: When a program throws an exception within
Q82: Consider the following code snippet:
Try
{
File inputFile =
Q84: Consider the following code snippet:
Try
{
PrintWriter outFile =
Q88: Consider the following code snippet: PrintWriter outputFile
Q89: Which of the following code snippets about
Q95: An example of a fatal error that
Q96: Which of the following statements about checked
Q96: If the current method in a program
Q100: Which of the following statements about exception
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