s*****i 发帖数: 650 | 1 String b = "\u000A"; is syntax error.
String b = "\u0009"; is right,
String b = "\u001A"; is right too.
why?
How to input "\u000A" into a variable?
thx | d******p 发帖数: 24 | 2 http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#100960
Because Unicode escapes are processed very early, it is not correct to
write '\u000a' for a character literal whose value is linefeed (LF); the
Unicode escape \u000a is transformed into an actual linefeed in translation
step 1 (§3.3) and the linefeed becomes a LineTerminator in step 2 (§3.4),
and so the character literal is not valid in step 3. Instead, one should
use the escape sequence '\n' (§3.10.6). Similarly, it
【在 s*****i 的大作中提到】 : String b = "\u000A"; is syntax error. : String b = "\u0009"; is right, : String b = "\u001A"; is right too. : why? : How to input "\u000A" into a variable? : thx
|
|