Long and same size in eclipse?

I don’t know if this is a particular eclipse problem, but whenever I declare a long one and try to put a value> 2 ^ 32, it complains about "the letter XXXXXX of type int is out of range"

I tried casting directly for a long time, but it seems to have no effect. What am I missing here?

+3
source share
2 answers

Try to create a long constant : 123456789123l(mark the letter at the end l)

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

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

Take a look at this topic . Do not get used to the IDE.

0
source

Source: https://habr.com/ru/post/1781300/


All Articles