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.
Hello all, I am new to java and have a question about file output. I am using the filewriter to access a basic text document. I am writing out short strings and would like each one on a new line but they are just being concatenated into one large string. I would like to be able to get my output to go on to a new line each time I write to the file. Any help? Thanks
Look at the documentation for PrintWriter. It has a method called print() which will print and stay at that line. So the next call to print() or println() will print on the same line. Another method called println() will print and terminate that line. So the next call to print() or println() will automatically print on a new line.
Ever Existing, Ever Conscious, Ever-new Bliss
Joined: Feb 02, 2004
Thanks a lot. The Print Writer method worked great.