What are the differences between char literals ‘\n’ and ‘\r’ in Java?

In Java, the newline and carriage return characters are both seem to be showing same effect.

What are the actual differences between char literals \n and \r in Java?


Note that the above asks about the \n character, not the newLine() function on BufferedWriter, and so this other question isn’t relevant.

Leave a Comment