模板模式
//抽象类
abstract class Templatee{
abstract void step1();
abstract void step2();
abstract void step3();
public final void execSteps(){
step1();
step2();
step3();
}
}
//具体类
class Templater extends Templatee{
void step1(){
System.out.println("this is step1");
}
void step2(){
System.out.println("this is step2");
}
void step3(){
System.out.println("this is step3");
}
}
//测试类
public class Template{
public static void main(String[] args){
Templater t=new Templater();
t.execSteps();
}
}