Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes unicode?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "unicode??" Watch "unicode??" New topic
Author

unicode??

srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252
1.4) Which one of the following are not valid character contants? [8]
Select any two.
(a)char c = '\u00001' ;
(b)char c = '\101';
(c)char c = 65;
(d)char c = '\1001' ;

here the values in option b and d are taken to be octal values ..how is it so??octal values should start with 0 ..right ...

please help

sri


Thanks & Regards<br /> <br />-Srikanth
Kris Krason
Greenhorn

Joined: Aug 05, 2005
Posts: 25
In char values, it is not needed to have 0 in front of octal.
Every backslash with one, two, three is considered an octal value of char.

Here's a link to JLS
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#101089

As you may see, octal digits can be in this form :

\[0-9]
\[0-9][0-9]
\[0-3][0-9][0-9]


Kris Krason<br />SCJP1.4 (96%)<br />SCJP1.5 (91%)<br /> <br />See my <a href="http://krisreviews.com/2006/12/code-complete-second-edition/" target="_blank" rel="nofollow">Code Complete review</a><br /> <br /><a href="http://www.coderookie.com/2006/tutorial/the-pseudocode-programming-process/" target="_blank" rel="nofollow">Pseudocode Programming Process</a>
 
 
subject: unicode??
 
Similar Threads
Dan question
chars
char literal
char literals
From Dan's exam