Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

char a = '\u000A'

 
sean cee
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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?
Thanks.
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Bill
 
Kourosh Keshavarzi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic