什么是反斜杠字符(\\)? [英] What is the backslash character (\\)?
本文介绍了什么是反斜杠字符(\\)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是字符串文字 \\
反斜杠?它有什么作用?我已经考虑过了,但我不明白。我也在维基百科上阅读了它。当我尝试打印以下内容时:
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");
输出为: Mango \ Nightangle
这个字符串文字有什么意义?
What is the significance of this string literal?
推荐答案
\
用于许多编程语言(包括Java)中的转义序列。
\
is used as for escape sequence in many programming languages, including Java.
如果你想
- 转到下一行然后使用
\ n
或\ r
, - 供标签使用
\t
- 同样打印
\
或这是特殊的字符串文字,你必须用另一个
\
来转义它,它给我们\\
和\
- go to next line then use
\n
or\r
, - for tab use
\t
- likewise to print a
\
or"
which are special in string literal you have to escape it with another\
which gives us\\
and\"
这篇关于什么是反斜杠字符(\\)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文