short a=10;
a=a+20;
这样就报错了,因为a是short,20是int
加一块是int,但等号左边是short,所以需要强制转换
a=(short)(a+20);
这样就不报错了
而a+=20;就不报错
得出结论,
+=隐含了强制类型转换