I stumbled over this (again) today:
class Test {
char ok = \'\\n\';
char okAsWell = \'\\u000B\';
char error = \'\\u000A\';
}
It
It is described in 3.3. Unicode Escapes http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html. Javac first finds \uxxxx sequences in .java and replaces them with real characters then compiles. In case of
char error = '\u000A';
\u000A will be replace with newline character code (10) and the actual text will be
char error = '
';