+ 2

How do i can print "\n" in java ?

"\n" is the escape fuction which provides us the new line but without going to new line how can we print in output " \n".

18th Sep 2018, 6:44 AM
Vaishnavi Dattatray Satav
Vaishnavi Dattatray Satav - avatar
3 Réponses
+ 7
System.out.println("\\n");
18th Sep 2018, 6:48 AM
Aleksander Szczepura
Aleksander Szczepura - avatar
+ 2
Vaishnavi Dattatray Satav, note that, actually, Olek Szczepura's reply contains another escape sequence -- "\\".
18th Sep 2018, 9:22 AM
Mykhajlo Shaforostov
Mykhajlo Shaforostov - avatar
+ 2
for every escape character use extra backslash... like \\n \\t
20th Sep 2018, 4:56 PM
Aarav Raj
Aarav Raj - avatar