我目前正在使用Java中的数据类型,如果我已正确理解该类型long
接受范围之间的值:-9,223,372,036,854到+9,223,372,036,854,775,807.现在你可以在下面看到我创建了一个名为Long的变量testLong
,虽然当我插入9223372036854775807作为值时,我得到一个错误说明:
"int类型的文字9223372036854775807超出了范围."
我不知道为什么它将long
数据类型称为int
有人有主意吗?
代码如下:
char testChar = 01;
byte testByte = -128;
int testInt = -2147483648;
short testShort = -32768;
long testLong = 9223372036854775807;
float testFoat;
double testDouble = 4.940656458412;
boolean testBool = true;
Run Code Online (Sandbox Code Playgroud)