public class SuperClass{
    public void printA(){
        System.out.print("SuperClass-printA");
        printB();
    }
    public void printB(){
        System.out.print("SuperClass-printB");
    }
}

public class ChildClass extends SuperClass{
    public void printA(){
        System.out.print("ChildClass-printA");
        super.printA();
    }
    public void printB(){
        System.out.print("ChildClass-printB");
    }
    public static void main(String[] args)
    {
        ChildClass childClass = new ChildClass();
        childClass.printA();
    }
}


子类通过super.printA()调用父类的方法,而在父类的printA()中调用了printB(),这种情况下,调用的是子类的printB()方法。