aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Confusion in \uxxxx !!! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Confusion in \uxxxx !!!" Watch "Confusion in \uxxxx !!!" New topic
Author

Confusion in \uxxxx !!!

tanu dua
Ranch Hand

Joined: Apr 05, 2004
Posts: 145
Hi all !

I was doing Dan Chislom Language Fundamentals Exam 2 when i encountered the following problem. Please help me out.



Output:

Compile Error at 2 Details of error :Unclosed String literal.

Problem :

Why there is a compile error even though \u000a represents \n.

Thanx
JiaYun Jia
Greenhorn

Joined: Jun 28, 2004
Posts: 7
There's a faq on this at jGuru

http://www.jguru.com/faq/view.jsp?EID=225894
Tybon Wu
Ranch Hand

Joined: Jun 18, 2002
Posts: 84
Because unicode characters are translated before compile. So basically the code gets translated to the following before it's compiled:

As you can see, /u000a is literally translated in to a new line in the source code.


SCJP2
Ganesh Prakhya
Ranch Hand

Joined: May 05, 2004
Posts: 76
hi

actually i think you forgot to include a semi colon in line 2 of your code.
just behind assignment of unicode character. i think this is your reason for
your compiler error.

tnx
tanu dua
Ranch Hand

Joined: Apr 05, 2004
Posts: 145
Thanx for all ur replies ,my doubts are cleared .. Thanx
Sanyev Babu
Ranch Hand

Joined: Dec 18, 2003
Posts: 132
All see this thread
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Confusion in \uxxxx !!!
 
Similar Threads
Unicode Character ??
character interpretation
Illegal statement in java
char literal
Write CR/LF at the end of a line