创建一个类,它带有一个被重载了3次的方法。继承产生一个新类,并添加一个该方法的新的重载定义,展示这4个方法在派生类中都是可以使用的。
public class Person {
public void aa(int a,int b,int c){
System.out.println("int abc");
};
public void aa(int a){
System.out.println("int a");
};
public void aa(double a){
System.out.println("double a");
};
}
public class Student extends Person {
public void aa(double a,double b){
System.out.println("double a,double b");
};
public static void main(String[] args) {
Student student=new Student();
student.aa(1,2);
student.aa(1);
student.aa(1.0);
student.aa(1.0,2.0);
}
}