java - Why cannot I assign value to a long variable that is between 2^64 and 2^32? -
this question has answer here:
- why can't assign 'long' value of 4 billion? 6 answers
- the literal xyz of type int out of range 3 answers
i trying test difference between int , long data types , i've learned int has 32 bits whereas long has 64 bits. according this, long data type's maximum value 9,223,372,036,854,775,807. using 13-digit number getting error:
error: integer number large: 2147483645234
long exceedlong = 2147483645234;
i thought long variable should able handle value. i'm using jdk , jre version 8 , i'm compiling , running code in command prompt, using javac , java.
Comments
Post a Comment