就是short long啊
基本数据类型 short,byte,char 编辑器会把它转化成int型
注意参数是 Short--不是short
参考代码如下
public class Yikes {
public static void go(Long n) {
System.out.println("Long");
}
public static void go(Short n) {
System.out.println("Short");
}
public static void go(int n) {
System.out.println("int");
}
public static void main(String[] args) {
short y = 6; // short,byte,char在进行运算时会自己转化成int型
long z = 7;
Short x = 8; //Short是short的包装类
go(y);//输出int
go(z);//输出 long
go(x); // 输出Short
}
}
先自动类型提升,再自动装箱