public class Test {
static void test(Integer x) {
System.out.println("Integer");
}
static void test(long x) {
System.out.println("long");
}
static void test(Byte x) {
System.out.println("byte");
}
static void test(Short x) {
System.out.println("short");
}
public static void main(String[] args) {
int i = 5;
test(i);
}
}
The output value is "long".
Can only tells me why it is not "Integer" since in Java, int value should be auto-boxed.