What is the string literal \\
backslash? What does it do? I have thought about it but I do not understand it. I also read it on wikipedia. When I try to print the following:
System.out.println("Mango \\ Nightangle");
the output is: Mango \ Nightangle
What is the significance of this string literal?
It is called a solidus in Unicode, is also known as an oblique stroke, and has several other historical or technical names including oblique and virgule.
Answer: The backslash key is located near the "Enter" or "Return" key on most keyboards. It is most often found directly to the left of the Enter key, but can also be placed below or above the enter key.
\
is used as for escape sequence in many programming languages, including Java.
If you want to
\n
or \r
, \t
\
or "
which are special in string literal you have to escape it with another \
which gives us \\
and \"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With