Int Java question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Int Java question

I don't understand why when I print the variable A the output is 8. int A = 010; System.out.print(A); //output is 8

16th May 2019, 3:51 PM
AFParadox
AFParadox - avatar
1 Answer
+ 8
The zero prefix for the number indicates that it is a number in octal (base 8), 10 in octal is 8 in decimal (base 10)
16th May 2019, 3:56 PM
Ipang