Solved

Consider the Following Code Snippet

Question 72

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions