0

How would you print double quotes (") ?

15th Jun 2017, 2:31 PM
Yash
Yash - avatar
4 Réponses
+ 2
Because, the " is a special character used to set when does the string begin and when it does end. If you put 3, the first will be parsed as beggining of the string, the second will be parsed as end, and the third will be parsed as an error. That's why you need the bachslash to escape the second " telling the compiler no to treat it as special.
15th Jun 2017, 2:38 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 13
System.out.println("\"");
15th Jun 2017, 2:31 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 12
Because quotes are special characters and must be escaped.... (otherwise you get an error, blame Java.....)
15th Jun 2017, 2:33 PM
Valen.H. ~
Valen.H. ~ - avatar
0
why cant we just use System.out.println(""");
15th Jun 2017, 2:32 PM
Yash
Yash - avatar