In the quiz I found one question where I need to calculate the program below
public static void main(String[] args) {
short x = 0;
int b = 08;
x +=b;
System.out.println("" + b + x );
}
It gives a compilation error on
int b = 08;
Like this is an octal value, so I tried several different values
int b = 07
int b = 08
int b = 09
int b = 010
Since 08 and 010 have the same decimal number, why does 08 give a compilation error.
Amit source
share