short a = 1;
short b = 2;
那么 a+b 是什么类型?
答案:int型;
a,b相加前先自动转换成了int,相加后当然是int。在编译器能看到Type mismatch: cannot convert from int to short
short a = 1;
short b = 2;
那么 a+b 是什么类型?
答案:int型;
a,b相加前先自动转换成了int,相加后当然是int。在编译器能看到Type mismatch: cannot convert from int to short