package father;
public class Father {
public Father(){
System.out.println("father");
}
public void abc(){
System.out.println("father abc");
}
}
package father;
public class Child extends Father{
public Child(){
System.out.println("child");
}
public void abc(){
System.out.println("child abc");
}
public static void main (String [] args){
// Father f =new Father();
// Child c=new Child();
// father
// father
// child
// 继承时候顺序的执行问题 先父类,在子类
// Father f=new Child();
// f.abc(); //父类abc方法被重写了,调用的为child的abc方法
// father
// child
// child abc
// 构造方法不存在重写,先执行父类的,再执行子类的
}
}