2

Declaring int constant like

 private static final int REQUEST_CODE = 0909;

this would result into "Integer number too large"

while private static final int REQUEST_CODE = 1909; works fine why would the android studio suggest that 0909 is too large but 1909 is fine

Rajnish Mishra
  • 826
  • 5
  • 21

1 Answers1

3

In Java, numbers with a leading 0 are treated as octal numbers. Octal numbers are base 8 and use the digits 0 through 7, while the digits 8 and 9 are not valid.

To declare a decimal constant, use:

private static final int REQUEST_CODE = 909;
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285