<分区>
Possible Duplicate:
How do I make a string with a " character in it? (Java)
我在 java 中打印这样的字符串时遇到问题 System.out.println("this is a "test"");
我该怎么做?
<分区>
Possible Duplicate:
How do I make a string with a " character in it? (Java)
我在 java 中打印这样的字符串时遇到问题 System.out.println("this is a "test"");
我该怎么做?
最佳答案
在 Java 中转义特殊字符的方法是使用 \
。例如。这个 ("\\"
) 是你返回 \
的方式,这个 ("\""
) 是你返回 "< 的方式
.
这就是您实现示例的方式:
System.out.println("this is a \"test\"");
关于java - 在 Java 字符串中打印 ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8719938/