Multiple Choice
Consider the following code snippet: try
{
PrintWriter outputFile = new PrintWriter(filename) ;
Try
{
WriteData(outputFile) ;
}
Finally
{
OutputFile.close() ;
}
}
Catch (IOException exception)
{
) . .
}
Which of the following statements about this code is correct?
A) The file will be closed regardless of when the exception occurs.
B) The file will be closed if the PrintWriter constructor throws an exception.
C) The file will be closed if the writeData() statement throws an exception.
D) It is not possible to determine whether the file will be closed if an exception occurs.
Correct Answer:

Verified
Correct Answer:
Verified
Q1: Assume that inputFile is a Scanner object
Q2: Which of the following statements about using
Q3: Insert the missing code in the following
Q5: When writing a method, which of the
Q6: Which of the following statements about exception
Q7: Insert the missing code in the following
Q8: Your program will read in an existing
Q9: Which Java class implements a file dialog
Q10: What is the purpose of the throw
Q11: Consider the following code snippet: Scanner in