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
posted 14 years ago
Thanks a lot. The Print Writer method worked great.