int a=0234;
int result=a/100;
System.out.println("result is " + result);
output:
result is 1
Why is result
not 2
?
0234
is an octal number which equals 2 * 82 + 3 * 81 + 4 * 80
, which is 156
.
Then 156/100 = 1 (due to integer division)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With