Isaaac_Perlman
Isaaac_Perlman

Reputation: 332

\n newline character is ignored by java

I'm writing to a txt file and I'm appending \n (newline character). the character is shown clearly in System.out.println. but this character is not shown in the textfile. therefore, the textfile is composed by only one long line

Upvotes: 2

Views: 1782

Answers (1)

rmartinus
rmartinus

Reputation: 690

What operating system are you using? If you're using Windows, try "\r\n" - or (more universally), System.getProperty("line.separator")

Upvotes: 11

Related Questions