今天想定義一個類常量,結果如下面那樣定義,確報錯了。
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