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. 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
Correct Answer:
Verified
Q13: Consider the following code snippet:<br>If (in.hasNextDouble())<br>{<br>Number =
Q14: Consider the following code snippet written in
Q15: Consider the following code snippet. File hoursFile
Q16: Assume that inputFile is a Scanner object
Q17: You wish to use the Scanner class's
Q19: Consider the following code snippet: Scanner in
Q20: Which method of an exception object will
Q21: Insert the missing code in the following
Q22: Consider the following code snippet: Scanner in
Q23: Assuming that inputFile is a Scanner object