Originally posted by Edwin Dalorzo:
From Java IO by Elliotte Rusty Harold.
Be careful. For the PrintWriters in use here, it's
not true that printing a '\n' calls flush() in auto-flush mode; it was (is) true for PrintStream, however.
It's also
not true that the chains of open PrintWriter/BufferedWriter/FileWriters will automatically be flushed on program exit. The underlying file stream will be closed and the OS buffer flushed, but the BufferedWriters are going to be holding some data, and that will be lost unless you flush() or close() the PrintWriters. Nothing is going to automatically close() or flush() them for you.