public class Father {
public Father(){
ss();
System.out.println("Father's Con End!");
}
public void s(){
System.out.println("This is Father's S!");
}
public void ss(){
System.out.println("This is Father's SS!");
s();
}
}
public class Child extends Father{
public void s(){
System.out.println("This is Child's S!");
}
public void ss(){
System.out.println("This is Child's SS!");
super.ss();
}
}
public class Test {
public static void main(String[] args) throws UnsupportedEncodingException {
Child child = new Child();
child.ss();
}
}
运行Test的输出为:
This is Father's SS!
This is Child's S!
Father's Con End!
This is Child's SS!
This is Father's SS!
This is Child's S!