java: integer number is too large

今天想定义一个类常量,结果如下面那样定义,确报错了。
error is: Integer number too large

public static final Long STARTTIME = 1493568000000;

我就去查了下,在后面加上L,就好了,就会作为long类型来处理了,若是不加,则作为int处理,而int是没有这么大的值的。
正确的则是

public static final Long STARTTIME = 1493568000000L;
1
注意: System.currentTimeMillis() 单位毫秒
System.nanoTime() 单位纳秒
1ms=10^6 ns
————————————————
版权声明:本文为CSDN博主「hizhangyuping」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/hizhangyuping/article/details/81540362

posted @ 2019-11-05 14:52  八英里  阅读(2732)  评论(0编辑  收藏  举报