重载:
改变参数数量或者改变参数类型
public class Super {
public void test1(int a,int b) {
}
public void test1(int a,int b,int c) {
}
public void test1(double a,int b) {
}
}
改变返回类型是不可以的
但同时改变了参数类型或者数量就可以
public class Super {
public void test1(int a,int b) {
}
public int test1(double a,int b) {
return 0;
}
public int test1(int a,int b,int c) {
return 0;
}
}