package operator;
public class Demo06 {
public static void main(String[] args) {
long a = 123123123123L;
int b = 123;
short c = 10;
byte d = 8;
System.out.println(a+b+c+d);//long类型
System.out.println(b+c+d);//int类型
System.out.println(c+d);//int类型
//如果有long就自动转换为long类型
//如果有double就自动转换为double
//如果没有long/double则都为int类型
//自动升为混合运算类型中最高类型
}
}
混合运算类型
于 2023-09-13 16:06:34 首次发布