class Person {
public int num;
public String name;
//---------构造Person()方法也是重写构造方法,因为方法名一样,参数不一样---------------------------------
public Person(int num) {
super();
this.num = num;
}
public Person(String name) {
super();
this.name = name;
}
public Person(int num, String name) {
super();
this.num = num;
this.name = name;
}
//===========================================
//-----------两个setValue方法都是重写方法,因为方法名一样,参数不一样-------------------------------
public void setValue(int num){
this.num = num;
}
public void setValue(int num,String name){
this.num = num;
this.name = name;
}
//===========================================
} |