In java, the \ char character is an escape character, which means that the next char is a kind of control character (e.g. \ n \ t or \ r).
To print literals in Java, run it with an extra \ char
For example:
String text = "\\n is used for a new line"; System.out.println(text);
It will be printed:
\ n is used for a new line
Andy guibert
source share