Using a BackSlash in Java

106 views Asked by At

I want to print out a backslash. However, I get an error:

//Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
System.out.println("\");
1

There are 1 answers

0
jongusmoe On

System.out.println("\\");

\ will escape the second \ character.