Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望引号 ( ") 成为字符串的一部分。即 System.out.println(myString); 应该输出 "hello" 而不仅仅是 hello
"
System.out.println(myString);
"hello"
hello
您必须转义引号:
String myString = "\"hello\"";
Java 规范的这一页提供了有关字符串文字和转义序列的所有需要的详细信息。
添加escape character (\)双引号。"\"hello\"".
escape character (\)
"\"hello\""