public class EscapeRout{
public static void main(String[] args){
// /u0022 is the Unicode escape for double quote(");
System.out.println("a/u0022.length() + /u0022b".length());
}
}
Soulution:
显示:2
其实是"ab"的字符长度。java认为/u0022也是双引号
TID:
Java provides no special treatment for Unicode escapes within string literals.The compiler translates Unitcode escapes into the characters they represents before it parses the program into tokens, such as strings literals.
A Unicode escape means exactly the same things as the character that it represents.
prefer escape sequences to Unicode escape in string and character literals.