字节+字节=int…为什么?
byte x = 1;byte y = 2;byte z = x + y; // ERROR: Cannot implicitly convert type 'int' to 'byte'
byte
short
byte z = (byte)(x + y); // this works
我们有:
int
+ int
= int
long
+ long
= long
float
+ float
= float
double
+ double
= double
所以为什么不:
byte
+ byte
= byte
short
+ short
= short
?
繁华开满天机
HUX布斯
开心每一天1111
相关分类