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
  • 838
  • 5
  • 20

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
  • 890,778
  • 177
  • 1,125
  • 1,260