扩展运算是个影藏boss

short a =1;

a+=1; //实际上是 a=(short)(a+1);

short a=1;

a=a+1; //不报错,应为进行算术逻辑运算会默认转为int类型,但是你要把int类型赋值给short类型,所以错了。

原文地址:https://www.cnblogs.com/wlmLinker/p/5651860.html