If you want to get new line characters used in current OS like
\r\n for Windows, you can get them by
You can also use
PrintStream and its
println method which will add OS dependent line separator at the end of your string automatically
PrintStream fileStream = new PrintStream(new File("file.txt")); fileStream.println("your data"); // ^^^^^^^ will add OS line separator after data
System.out is also instance of PrintStream).
~ Answered on 2013-08-31 15:37:02