Hi Charissa Thomas,
First of all, a warm welcome to CodeRanch!
Charissa Thomas wrote:Please advise how I would write a 21 digit octal number or if this is incorrect, I will need to report that for the books errata notes.
It is definitely not an errata item. Each integer literal in
Java is by default an
int. If you have a literal which is outside the range of an
int, you need an indicator to tell the compiler it should be handled as a
long and not an
int; otherwise you'll end up with a compiler error (as you have experienced). Adding the
L (or
l) suffix will fix this compiler error. You'll find more detailed info in
this post.
And
here you'll find another topic about literals with a bunch of code snippets. And if you like to know what happens if you use suffix
D (or
d) and
F (or
f) in hexadecimal literals,
you should definitely read
this topic and
this one.
Hope it helps!
Kind regards,
Roel