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.printf("你好!");
}
public void averageHeight(){
System.out.println("中国人的平均身高:173.0厘米");
}
public void averagWeight(){
System.out.println("中国人的平均体重:67.34公斤");
}
public 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("Amerian Average height:188.0 cm");
}
public void averageWeight(){
System.out.println("Amerian Average weight:80.23 kg");
}
public void americanBoxing(){
System.out.println("直拳,勾拳");
}
}
class BeijingPeople extends ChinaPeople
{
public void speakHello()
{
System.out.println("您好!");
}
public void averageHeight(){
System.out.println("北京人平均身高:167.0厘米");
}
public void averageWeight(){
System.out.println("北京人的平均体重:68.5公斤");
}
public void beijingOpera(){
System.out.println("京剧术语");
}
}
}
public class Examp {
public static <AmericanPeople> 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();
beijingPeople.chinaGongfu();
}
}
请问一下哪错了??
------解决方案--------------------
你在chinapeople 内部 定义了 内部类 改改