交作业,大神多指点
public abstract class People {
public abstract void yuyan();
}
public class China extends People {
@Override
public void yuyan() {
// TODO Auto-generated method stub
System.out.println("中国人说汉语");
}
}
public class American extends People {
@Override
public void yuyan() {
// TODO Auto-generated method stub
System.out.println("美国人说英文");
}
}
public class InnerDeom {
public static void main(String[] args) {
// TODO Auto-generated method stub
People p1 = new China();
p1.yuyan();
People p2 = new American();
p2.yuyan();
}
}
输出:
中国人说汉语
美国人说英文