The above answers provided are perfect. The LF(\n
), CR(\r
) and CRLF(\r\n
) characters are platform dependent. However, the interpretation for these characters is not only defined by the platforms but also the console that you are using. In Intellij console (Windows), this \r
character in this statement System.out.print("Happ\ry");
produces the output y
. But, if you use the terminal (Windows), you will get yapp
as the output.