+ 1
what is \r ??? in java.
what is \r ???
4 Respostas
+ 4
This is not only in java. '\r' is the representation of the special character CR (carriage return), it moves the cursor to the beginning of the line.
'\n'(line feed) moves the cursor to the next line .
On windows both are combined as \r\n to indicate an end of line (ie, move the cursor to the beginning of the next line).
+ 3
\n is enough on linux to indicate end of line. But both are needed on windows.
If you open a linux text file in notepad you will see all text on a single line. And a Windows text file in a linux editor may show a ^M at the end of each line.
Most editors have a conversion option.
0
got it
- 1
but cant \n alone do this??