子类在new对象中会调用父类的构造函数,而父类的构造函数再调用子类的实现方法,这种设计模式叫做什么
public class Capture {
public static void main(String[] args) throws IOException {
Student student = new Student();
}
}
abstract class Users{
public Users(){
say();
}
protected abstract void say();
}
class Student extends Users{
@Override
protected void say() {
System.out.println("你好世界");
}
}