//人的类
abstract class Person
{
private String name;
private int age;
public Person(){}
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return name;
}
public void setAge(int age)
{
this.age=age;
}
public int getAge()
{
return age;
}
//睡觉的方法
public void sleep()
{
System.out.println("睡觉");
}
//吃饭的方法
public abstract void eat();
}
//运动员的类
abstract class Player extends Person
{
public Player(){}
public abstract void study();
}
//教练类
abstract class JiaoLian extends Person
{
public JiaoLian(){}
public abstract void teach();
}
//定义一个乒乓球运动员类
class PingpangPlayer extends Player implements SpeakEnglish
{
public PingpangPlayer(){}
public void study()
{
System.out.println("乒乓球运动员学习推挡");
}
public void eat()
{
System.out.println("乒乓球运动员吃泡面");
}
public void speak()
{
System.out.println("乒乓球运动员需要学习英语");
}
}
//定义一个篮球运动员类
class BasketPlayer extends Player
{
public BasketPlayer(){}
public void study()
{
System.out.println("蓝球运动员学习运球");
}
public void eat()
{
System.out.println("蓝球运动员吃牛肉");
}
}
//定义一个乒乓球教练类
class PingPangCoach extends JiaoLian implements SpeakEnglish
{
public PingPangCoach(){}
public void teach()
{
System.out.println("乒乓球教练教推挡");
}
public void eat()
{
System.out.println("乒乓球教练爱吃老婆做的饭");
}
public void speak()
{
System.out.println("乒乓球教练需要学习英语交流");
}
}
//定义一个篮球教练类
class BasketCoach extends JiaoLian
{
public BasketCoach(){}
public void teach()
{
System.out.println("蓝球教练教运球");
}
public void eat()
{
System.out.println("蓝球教练爱吃自己做的饭");