Is 00 an integer or octal in Java?

Solution 1:

All are integers, but...

1  is decimal
0  is decimal
01 is octal
00 is octal

From Java Language Specification (emphasis mine):

Note that octal numerals always consist of two or more digits; 0 is always considered to be a decimal numeral - not that it matters much in practice, for the numerals 0, 00, and 0x0 all represent exactly the same integer value.

Solution 2:

Number literal representation examples in Java will give you the answer:

int decimal = 100;
int octal = 0144;
int hex = 0x64;
int binary = 0b1100100;

So 00, 000 and 0000 are all octal(base-8) integers.

Solution 3:

Directly from specification

An octal numeral consists of an ASCII digit 0 followed by one or more of the ASCII digits 0 through 7 and can represent a positive, zero, or negative integer.

You can check 0 though 7