This code should give output as the given format [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question 开发者_Go百科This is code in java for string.
int a=6;
int b=7;
System.out.println(a+"\"+b);
I want to comes the output is 6\7
.
write this code:
System.out.println(a+"\\"+b);
In literal Java strings the backslash is an escape character. The literal string "\\"
is a single backslash.
In regular expressions, the backslash is also an escape character. The regular expression \\
matches a single backslash. This regular expression as a Java string, becomes "\\\\"
. That's right: 4 backslashes to match a single one.
精彩评论