public class TextOverride {
public static void main(String[] args) {
Daughter d=new Daughter();
d.playPoke(" ");
}
}
class Mather {
int money = 1231232133;
String car = “hummar”;
public Mather() {
}
public int getMoney() {
return money;
}
public void setMoney(int money) {
this.money = money;
}
public String getCar() {
return car;
}
public void setCar(String car) {
this.car = car;
}
public void playPoke(String words) {
System.out.println("斗地主"+words);
}
}
/*函数名和参数列表完全一致
* 用 @Override检测
*/
class Daughter extends Mather {
@Override
public void playPoke(String words) {
System.out.println("变魔术"+words);
}
}