Hi,
I was referring to the Oracle Certified Associate
Java Programmer I by Mala Gupta and was solving the few questions.
I had a small doubt on a topic of Liternal for Numerical Datatypes.
Here is the Question.
Determine which of these does initialization job correctly:
long var1 = 0_100_267_760;
long var2 = 0_x_4_13;
long var3 = 0b_x10_BA_75;
The answer marked by the book are : var1 and var3
Edit:
But according to me, the answer should be only var3 as the underscore cannot follow directly after a representation like 0b, 0x, 0B,0X or 0 (used for octal indication).
**
But according to me, the answer should be only var3 as the underscore can follow a representation like 0b, 0x, 0B,0X or 0 (used for octal indication).
and var 1 initialization has 0_100_267_760 which can be a Octal Number?
Am I wrong here?
The answer can also include var1 if and only if liternal is not octal. But how can we come to know its not octal or is octal? ...
Rather confused in all this,
Regards,
Ashish