Skip to content

Tag: double-quotes

How can I make Java print quotes, like “Hello”?

How can I make Java print “Hello”? When I type System.out.print(“Hello”); the output will be Hello. What I am looking for is “Hello” with the quotes(“”). Answer The double quote character has to be escaped with a backslash in a Java string literal. Other characters that need special treatment include: Carriage return and newline: “r” and “n” Backslash: “\” Single