This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Since you're using a BufferedWriter, it doesn't matter much whether the PrintWriter is buffered (and I think it isn't, because that's what BW is for). The important thing is that the data does get buffered before being written to disk, and that's what happens here.
Joined: Jan 28, 2004
Thanks for your advice. Actually, I'm worrying about buffering twice if PrintWriter already buffered.
I attached my pw to the console output.This code will not print the output to the screen because pw.flush() is not invoked(commented as you see).If you uncomment it,you'll see the output on the screen becuase it "flushes" its buffer and sends the data to the output stream which is the console output here.