System.out.println("Hello \rWorld");
Output:- world
why is the Hello missing, I am using Windows. How does /r,/n,/r/n differ ?
System.out.println("Hello \rWorld");
Output:- world
why is the Hello missing, I am using Windows. How does /r,/n,/r/n differ ?
\r is carriage return (CR) \n is Line feed (LF)
\r\n is a carriage return with the newline char Windows, and DOS before it, uses a pair of CR and LF characters to terminate lines
\n UNIX (Including Linux and FreeBSD) uses an LF character only
OSX also uses a single LF character( 0x0A ), but the classic Mac operating system used a single CR character for line breaks( 0x0D ).
You can read more at Link and from a previously asked StackOverflow Question