programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Tim Cooke
• Devaka Cooray
• Ron McLeod
• Jeanne Boyarsky
Sheriffs:
• Liutauras Vilda
• paul wheaton
• Junilu Lacar
Saloon Keepers:
• Tim Moores
• Stephan van Hulst
• Piet Souris
• Carey Brown
• Tim Holloway
Bartenders:
• Martijn Verburg
• Frits Walraven
• Himai Minh

# Possible errata/doubt in k & b scjp 6 chapter 3 octal literals

Greenhorn
Posts: 22
• Number of slices to send:
Optional 'thank-you' note:
Hi
I have been trying to find errata for SCJP 6 book but unable to find it so posting the question here.
Octal literals can have up to 21 digits not including the leading 0.
My question is whether this accounts for the sign bit which makes it possible to create a literal like:

which makes it 22 digits excluding the leading 0.

I was hoping I could find an errata link so I did not need to post this question.
I hope some one can point me to it.

Regards

Ranch Hand
Posts: 814
• Number of slices to send:
Optional 'thank-you' note:
Hi Sunny,

See the following

Primitive long type hold 64 bits.
1st bit shows sign of value and another remaining 63 bits shows numeric value of primitive long type.
In the following literal
First leading zero indicate this number as octal literal representation.
Octal literal representation means every digit in this number is combination of 3 bits so there are 21 digits means 63 bits which represent value of number.
I break up the number in following binary number form

First one shows leading 0 to indicate it is octal literal
Second 1 shows sign of number. In this first 001 combination 00 has no value so it is equivalent to 1 that is 001 => 1
and reamaining bits shows value of long type number.

Correct me if I am wrong

Sunny X Narula
Greenhorn
Posts: 22
• Number of slices to send:
Optional 'thank-you' note:
Thanks for the explanation Ninad
I would still appreciate if someone could point me to the book's errata.

Regards

 How do they get the deer to cross at the signs? Or to read this tiny ad? the value of filler advertising in 2021 https://coderanch.com/t/730886/filler-advertising