+ 1
What is the difference of \n and \r in Java?
Since both function is new line, what is the difference? and give example scenario of use.
4 Réponses
+ 3
Just want to add that you should use System.lineSeparator() to keep the code platform independent.
Cheers ^^
0
No. \n for linux \r\n for windows
0
\n works on windows too when you print something on screen, \r\n you get when you read text from files.
\r \n are ascii code chars, in printer commands \n turn printer roller and feed paper about one line, \r move printer head to start position at begin of line.