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(""
).
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(""
).
System.out.println("\"Hello\"");
Take note, there are a few certain things to take note when running backslashes with specific characters.
System.out.println("Hello\\"); *edited
The output above will be :
Hello\
System.out.println(" Hello\" "); The output above will be:
Hello"
This is probably the best answer you'll find:
You can do it using a unicode character also
Use Escape sequence.
This will print "Hello".
You are looking for Escape Sequences
See more List of Escape Sequences