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 char  a = '\u000A' 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 "char  a = Watch "char  a = New topic

char a = '\u000A'

sean cee
Ranch Hand

Joined: Oct 24, 2000
Posts: 115
Why is this invalid?
I thought the range for char is u0000 to uffff ?
apparently a and d are not valid...
can anyone tell me?

Sean <br />SCJP2, SCJP2p1.4, SCWCD
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
This was explained in another posting, so you can do a search to find a more detailed answer. But the short of it is because the '\u000A' is the unicode for the return or \n. So what happens is that when you say:
char a = '\u000A'; you end up getting this:
char a =
because it returns to the next line and then types in your ;. So you always want to use \n instead.
Kourosh Keshavarzi
Ranch Hand

Joined: Oct 23, 2000
Posts: 66
We don't need to know this stuff for the exam do we?
Do we need to memorize which unicodes are valid and which are not
and what value each one has?
Is there a small subset of them that are well know that we definitly need to memorize?
Udayan Naik
Ranch Hand

Joined: Oct 18, 2000
Posts: 135
Mr Kourosh , you don't have to memorize anything for the exam.But your fundamentals and concepts should be clear enough.
Come on in !! Drinks are on the house in the Big Moose Saloon !!

Udayan Naik<BR>Sun Certified Programmer for the Java 2 Platform
I agree. Here's the link:
subject: char a = '\u000A'
It's not a secret anymore!