2016-07-07 49 views
-1

我宣佈Long checkRandom=0101010101l; 但是當我打印checkRandom它印checkRandom==17043521 什麼是它採取checkRandom=17043521checkRandom=0101010101爲什麼Long值在java中沒有正確打印?

+6

數字以零開始被處理作爲八進制。 –

+0

或[this one](http://stackoverflow.com/questions/5540179/long-value-with-0-on-left)。 –

+1

似乎更多的[this](http://stackoverflow.com/questions/16611185/unexpected-int-integer-behavior-when-number-starts-by-0)給我。 – BackSlash

回答

1

只需刪除0領先的原因:

Long checkRandom=101010101l