不知道怎么解决这个问题,请高手帮忙测试下
class People{
protected double weight,height;
public void speakHello()
{
System.out.println("yayawawa");
}
public void averageHeight()
{
height=173;
System.out.println("average height:"+height);
}
public void averageWeight()
{
weight=70;
System.out.println("average weight:"+weight);
}
}
class ChinaPeople extends People
{
public void speakHello()
{
System.out.println("你好,吃了吗");
}
public void averageHeight()
{
System.out.println("中国人的平均身高:168.78厘米");
}
public void averageWeight()
{
System.out.println("中国人的平均体重:65公斤");
}
public static void chinaGongfu()
{
System.out.println("坐如钟,站如松,睡如弓");
}
}
class AmericanPeople extends People
{
public void speakHello()
{
System.out.println("How do you do");
}
public void averageHeight()
{
System.out.println("American Average height:188.0 cm");
}
public void averageWeight()
{
System.out.println("American Average weight:82.23 kg");
}
public void americanBoxing()
{
System.out.println("直拳");
}
}
class BeijingPeople extends ChinaPeople
{
public void speakHello()
{
System.out.println("你好");
}
public void averageHeight()
{
System.out.println("北京人的平均身高:166.0厘米");
}
public void averageWeight()
{
System.out.println("北京人的平均体重:67.4公斤");
}
public void beijingOpera()
{
System.out.println("京剧术语");
}
public class Example1
{
public static void main(String args[])
{
ChinaPeople chinaPeople=new ChinaPeople();
AmericanPeople americanPeople=new AmericanPeople();
BeijingPeople beijingPeople=new BeijingPeople();
chinaPeople.speakHello();
americanPeople.speakHello();
beijingPeople.speakHello();
chinaPeople.averageHeight();
americanPeople.averageHeight();
beijingPeople.averageHeight();
chinaPeople.averageWeight();
americanPeople.averageWeight();
beijingPeople.averageWeight();
ChinaPeople.chinaGongfu();
americanPeople.americanBoxing();
beijingPeople.beijingOpera();
ChinaPeople.chinaGongfu();
}
}
}