如何在Java中的字符串中打印\ n [英] How to print \n in a String in java
本文介绍了如何在Java中的字符串中打印\ n的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要打印\ n.
String text = "";
text = "\n is used for new line";
,但是运行代码时未显示\ n.这该怎么做?
but the \n is not showing when I run the code. How to do this?
推荐答案
用 \
text = "\\n is used for new line";
这篇关于如何在Java中的字符串中打印\ n的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文