This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
No, actually -- my code and your code do two different things. Mine is passing a second boolean argument to the PrintWriter constructor; if you look at the Javadoc, you'll see that means to "autoflush", or update the underlying file each time you call one of the println() methods. Your version passes the boolean to the FileWriter constructor, which , again by looking at the Javadoc, you can see means to open the file in "append mode", as opposed to truncating the file to zero length. Both boolean arguments are valid and useful in their own place, and in fact, the line of code could have a "true" or "false" in both of those places at once, or neither, and still be correct (although of course each version does something a little different.)
Joined: Feb 01, 2006
Well thank you for clearing that up and I stand corrected