What I wanted was this "A \n", and instead, what I got was a COMPILE ERROR
String literal is not properly closed by a double-quote
What the hell! I have represented characters as unicode earlier in my Java code. So what was wrong here. It seems the compiler did not like the unicode newline character I had added. Here's why...
The compiler translates unicode characters at the beginning of the compile cycle. Which means the above source first gets converted to
before compilation starts. Now it is quite obvious why compilation would fail. Check out section 3.2 on Lexical Translations to understand what exactly happens in the translation phase of lexical analysis.
You might also enjoy reading this issue of the Java Specialists newsletter.
If you trying to represent newline or carraige return characters as unicode in your Strings, don't bother. It will not work. Use "\n" and "\r" instead.