There is no such thing as escape characters at run time.
Escape characters appear only in String literals. For example,
String literal = "Some\nEscape\rSequence\\\"";
At compilation time, the compiler produces a String
value with their actual binary representation (UTF-8
iirc). The JVM uses that String
value directly.
You wrote
I am thinking that whenever we print a string and the output contains character such as " and
\
, then we can conclude that those character, " and\
was escaped?
This is not true, those characters might have been read from a file or some other InputStream
. They were definitely not escaped in a text file.