外观模式,我的理解是将不同类的操作步骤集中到一起,达到封装的效果。
public class Step1 {
public void doStep1() {
System. out .println("do step1" );
}
}
public class Step2 {
public void doStep2() {
System. out .println("do step2" );
}
}
public class Facade {
public void doStep() {
Step1 step1 = new Step1();
Step2 step2 = new Step2();
step1.doStep1();
step2.doStep2();
}
}
public class FacadeClient {
public static void main(String[] args) {
Facade facade = new Facade();
facade.doStep();
}
}