Unicode escape sequences, such as \u000a , are replaced with the actual characters they represent before the Java compiler does anything else with the source code. So your program ends up ending in
char ch = ' ';
Thus, \u000a in the source code is replaced internally with a newline character. Note that this happens before the compiler actually reads and interprets your source code.
Referring to Java Language Specifics :
This is a compile-time error for the line terminator (§3.4), which appears after opening "and before closing".
And also everyone knows by heart, \n is a line terminator , quoting:
LineTerminator: the ASCII LF character, also known as "newline" the ASCII CR character, also known as "return" the ASCII CR character followed by the ASCII LF character
Other characters that may cause problems, such as \ , ' and " .
poitroae Mar 07 '13 at 16:13 2013-03-07 16:13
source share