Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

09 is not recognized where as 9 is recognized [duplicate]

I am using quartz for schedulling.

TriggerUtils.getDateOf(0,40,18,09,06);

it accept 5 parameter. (seconds, minutes, hours, daysOfMonth, month).

When i pass fourth parameter as "09". Eclipse give me error "The literal Octal 09 (digit 9) of type int is out of range ".

But when i pass the fourth parameter as "9" instead of "09", it works.

Can anyone explain me this error?

like image 331
Shashi Avatar asked Jun 09 '09 13:06

Shashi


2 Answers

In java, if you are defining an integer, a leading '0' will denote that you are defining a number in octal

int i = 07; //integer defined as octal
int i = 7; // integer defined as base 10
int i = 0x07; // integer defined as hex
int i = 0b0111; // integer defined as binary (Java 7+)
like image 197
3 revs Avatar answered Oct 09 '22 04:10

3 revs


There is no 9 in Octal (what you get with a preceding 0). 0-7, only.

like image 20
Eric Avatar answered Oct 09 '22 06:10

Eric