8 Years
Discussion Span
Last Post by dorotalp91

It can't hurt so when in doubt, do it. As far as I know the only possible consequence is that no other file will be able to open the file for writing until you close the FileWriter, but I also suspect that garbage collection might cause the FileWriter to relinquish its resources as part of the garbage collection process anyway. Again, those are my suspicions, do not take them as fact. But do know that only one thread at a time can have a file open for writing, so if your FileWriter is not closed, you haven't given that resource back to the OS, and as a result, nobody else can write to the file while it is open.

Edited by BestJewSinceJC: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.