0

Why does

System.out.println(0100);

print 64 to the console?

Its not like its converting to binary.

Randy
  • 5
  • 1
  • 4

1 Answers1

0

An integer starting with a 0 is interpreted in base 8 (as starting with 0x gives you base 16). Thus 0100 is 100 in base 8, which is 1 * 8^2 = 64.

Islingre
  • 2,030
  • 6
  • 18