跟byte类似,short也是这样的问题,short s = 0x7fff;正确 而short s = 0x8000;错误
对了,我的JDK版本是1.6.0_10
分享到:
------解决方案-------------------- A hexadecimal numeral consists of the leading ASCII characters 0x or 0X followed by one or more ASCII hexadecimal digits and can represent a positive, zero, or negative integer. Hexadecimal digits with values 10 through 15 are represented by the ASCII letters a through f or A through F, respectively; each letter used as a hexadecimal digit may be uppercase or lowercase.
0x开头的数字都是int类型,而不是byte或者short类型。 ------解决方案--------------------