对于short s1=1;s1=s1+1;由于1是int类型,因此s1+1运算结果也是int类型,需要强制转换类型才能赋值给short型。而short s1=1;s1+=1;可以正确编译,因为s1+=1;相当于s1=(short)(s1+1);其中隐含着强制类型转换。