Common problem. The end-of-line marker varies from platform to platform and simple-minded programs like Windows Notepad can't tell the difference. Windows uses "/n/r", Unix '/n' and Mac '/r'. Since
Java is designed to be cross platform one can obtain proper marker in a couple of different ways:
System.getProperties("line.separator") will return it as a
String. java.io.PrintWriter.println() will append the proper separator with each call.
java.io.BufferedWriter.newLine() will write a line separator directly to the file.
Use whatever method fits best with your requirements.