In java,
"Carriage return" is represented as '\r'
&
"Line Feed" is represented as '\n'
.
But Java does not allow,
"Carriage return" as '\u000d'
and
"Line Feed" as '\u000a'
.
Why?
The Unicode escape sequences are applied earlier in the source transformation than the character literal escape sequences. Unicode escape sequences are transformed very early in the process - before any other lexing happens, including before line breaks are detected. See JLS 3.2 for details.
So when you put \u000a
into a Java source file, it will behave exactly as if you'd put an actual line feed in there - causing a line break as far as the rest of the compiler is concerned.
(Personally I think this was a design mistake; I prefer the C# approach of only allowing Unicode escape sequences at very specific points in the code, but that's a different matter.)
See more on this question at Stackoverflow