File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes character interpretation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "character interpretation" Watch "character interpretation" New topic

character interpretation

roja potti

Joined: Mar 30, 2004
Posts: 15
this is my code
class chrI
public static void main(String[] args)
String a="\u000a"; //here
String b="\u000d"; //here
System.out.println("a= " +a);
System.out.println("b= " +b);
When I compile this code I am getting an error saying unclosed string literal( where I mentioned as here).
When I try the same code with "\u000b","\u000c","\u000e","\u000f" I am getting no error.
I am not understanding why???
Could you help me???
Dan Andrei
Ranch Hand

Joined: Jan 21, 2004
Posts: 92
'\u000d' = CR – carriage return complle error if used like this, use instead ‘\r’
'\u000a' = LF – line feed return sa also compile error, if used like this , use instead ‘\n’
Both of the above are line terminators, and give compile errors so you can think of them as "reserved Unicode"
for more details look at JLS chap 3
Hope that helps

"Did anyone understand what I have just explained? ... because I did not!"
I agree. Here's the link:
subject: character interpretation
jQuery in Action, 3rd edition