A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Joined: Jul 28, 2005
Oct 13, 2005 03:58:00
1.4) Which one of the following are not valid character contants? 
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 ...
Thanks & Regards<br /> <br />-Srikanth
Joined: Aug 05, 2005
Oct 13, 2005 04:26:00
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
As you may see, octal digits can be in this form :
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>
From Dan's exam
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015