Stephan van Hulst wrote:Correct.
The reason that it works this way is that it enables you to catch any exception that might arise from the closing of a resource:
Thanks. I have a further question.
Are you saying that if one of the resources throws a checked exception (say, FileNotFoundException) then we do
not have to catch it explicitly because the implicit finally block will do it for us?
I understand that in the older explicit
try-finally, we would have to explicitly have a
catch for this checked exception.