http://www.verejava.com/?id=16992794557845
/**
3. 继承的限制
java 不运行多继承, 也就是只能继承一个类, 但是其父类可以再继承一个类
继承具有传递性
*/
public class Inheritence2 {
public static void main(String[] args) {
//生出一个儿子
Child son = new Child();
}
}
class ChinesePeople {
public ChinesePeople() {
System.out.println("实例化中国人种");
}
}
class Father extends ChinesePeople {
public Father() {
System.out.println("实例化父亲");
}
}
class AmericaPeople {
public AmericaPeople() {
System.out.println("实例化一个美国人种");
}
}
class Mother extends AmericaPeople {
public Mother() {
System.out.println("实例化妈妈");
}
}
class Child extends Mother {
public Child() {
System.out.println("实例化儿子");
}
}