开发者

long and int same size in eclipse?

Don't know if this is an eclipse specific problem but whenever I declare a long and try to put a value > 2^32 in it complains about "the literal XXXXXX of type int is out of开发者_JAVA百科 range"

I've tried casting is directly to long but is doesnt seem to have any effect. What am I missing here?


Try creating long constant: 123456789123l (note letter l in the end)

long l = 123456789123; // error, constant `123456789123` has type int

long l1 = 123456789123l; // will work
long l2 = 123456789123L; // will work too


Look at this topic . Don't be addictive to IDEs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜