This is described in section 3.10.1 of the Java Language Specification . Basically, the decimal literal is either 0 or 1-9, followed by one or more characters 0-9.
An octal literal is 0, followed by one or more 0-7 characters.
So, 01234 is considered octal.
(Itβs also interesting that β0β is a decimal literal, but β00β is an octal literal. I cannot imagine situations where it matters, remember, given that the values ββare obviously the same.)
Jon skeet
source share