public class OverLoad {
void method(Integer i){
System.out.println("Integer "+i);
}
void method(int i){
System.out.println("in "+i);
}
public static void main(String a[]){
OverLoad m= new OverLoad();
m.method(2);
}
}
If I call m.method(3), it will call the int method, why? If I call m.method((Integer)3), then it will call the Integer method.
By default, it goes into a primitive data type
source
share