09 is not recognized where as 9 is recognized(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+)
这篇关于09 不被识别,而 9 被识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:09 不被识别,而 9 被识别
基础教程推荐
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 存储 20 位数字的数据类型 2022-01-01
