java整型有四种:byte(1字节),short(2字节),int(4字节),long(8字节)
0x100080000000 之所以超出范围,并不是long不能保存这么大,而是这个数是个int型数,所以当然超出了int范围(The literal 0x100080000000 of type int is out of range),在整数赋值时,右边默认都是int型,这时你将赋值语句修改为:
long y=0x100080000000l;//(最后一个是小写L)指定它的类型为long型就可以了
JVM资料:The JVM operand stack and local variables are defined to hold 32-bit values.So 64-bit long values that are stored on the operand stack or in local variables must be represented as two 32-bit entries.
意思是JVM 操作数栈及本地变量都定义成32位的值,所以存储在操作数栈或本地变量里的64位的long数值都必须被表示为两个32位的实体.