Reputation: 838
WhenI use try with resources in a program written in Java 8, documentation, is it still necessary or a good practice to close files explicitly?
Upvotes: 2
Views: 149
Reputation: 471
From the documentation you linked: "Note: A try-with-resources statement can have catch and finally blocks just like an ordinary try statement. In a try-with-resources statement, any catch or finally block is run after the resources declared have been closed."
So, no. You don't need to.
Upvotes: 5