Multiple Choice
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. try
{
String filename = . . .;
Scanner in = new Scanner(new File(filename) ) ;
) . .
}
___________________
{
Exception.printStackTrace() ;
}
A) catch (IOException exception)
B) catch (new exception (IOException) )
C) catch (IllegalArgumentException exception)
D) catch (IOException)
Correct Answer:

Verified
Correct Answer:
Verified
Q23: Assuming that inputFile is a Scanner object
Q24: Consider the following code snippet: throw new
Q25: Which statement about handling exceptions is true?<br>A)
Q27: Consider the following code snippet: System.out.printf("%-12s%8.2f",description,totalPrice);<br>Which of
Q29: Which of the following statements about using
Q30: Consider the following code snippet. Scanner inputFile
Q31: Which of the following statements about exception
Q32: Insert the missing code in the following
Q33: Consider the following code snippet: throw IllegalStateException("This
Q101: The _ method of the Character class