标签:tor print def ade block line var ati operator
public interface Command {
void execute();
}
?
public class CommandA implements Command{
public void execute() {
System.out.println("a执行了");
}
}
?
public class CommandB implements Command{
public void execute() {
System.out.println("生成html");
System.out.println("执行业务流程");
System.out.println("生成文书");
System.out.println("上传文档");
}
}
?
?
public class Invoker {
private Command command;
?
public Invoker(Command command) {
this.command = command;
}
?
public void execute(){
this.command.execute();
}
}
?
public class Main {
public static void main(String[] args) {
CommandA commandA = new CommandA();
CommandB commandB = new CommandB();
?
Invoker invoker = new Invoker(commandB);
invoker.execute();
?
Invoker invoker2 = new Invoker(commandA);
invoker2.execute();
}
}
?
标签:tor print def ade block line var ati operator
原文地址:https://www.cnblogs.com/q1359720840/p/14766618.html