09 不被识别,而 9 被识别
我正在使用石英进行调度.
I am using quartz for schedulling.
TriggerUtils.getDateOf(0,40,18,09,06);
它接受 5 个参数.(秒、分、小时、daysOfMonth、月).
it accept 5 parameter. (seconds, minutes, hours, daysOfMonth, month).
当我将第四个参数作为09"传递时.Eclipse 给我错误int 类型的字面八进制 09(数字 9)超出范围".
When i pass fourth parameter as "09". Eclipse give me error "The literal Octal 09 (digit 9) of type int is out of range ".
但是当我将第四个参数传递为9"而不是09"时,它可以工作.
谁能解释一下这个错误?
Can anyone explain me this error?
推荐答案
在java中,如果你定义一个整数,前面的'0'表示你定义一个八进制数
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+)
相关文章