Why the bar with int i signature is called?
public class Test {
public static void main(String[] args) {
bar(5); // What type of the integer "5"?
}
public static void bar(short i) {
System.out.println("short");
}
public static void bar(int i) {
System.out.println("int");
}
public static void bar(long i) {
System.out.println("long");
}
}
I've checked the Oracle's documents 15.12. Method Invocation Expressions and 15.28. Constant Expressions, while still have no idea.
Could someone explain the type of the constants expression? Like the type of "5" above?
Thanks!
