@@ -0,0 +1,910 @@
+// --------------------- interface%0A%0Apublic interface Strategy %7B%0A    void doSomething();%0A%7D%0A%0A// --------------------- concrete class%0A%0Apublic class ConcreteStrategy1 implements Strategy %7B%0A    public void doSomething() %7B%0A        System.out.println(%22ConcreteStrategy1 doSomething...%22);%0A    %7D%0A%7D%0A%0Apublic class ConcreteStrategy2 implements Strategy %7B%0A    public void doSomething() %7B%0A        System.out.println(%22ConcreteStrategy1 doSomething...%22);%0A    %7D%0A%7D%0A%0A// --------------------- context class%0A%0Apublic class Context %7B%0A    private Strategy strategy = null;%0A%0A    public Context(Strategy strategy) %7B%0A        this.strategy = strategy;%0A    %7D%0A%0A    public void doAnything() %7B%0A        this.strategy.doSomething();%0A    %7D%0A%7D%0A%0A// --------------------- test code%0A%0Apublic static void main(String%5B%5D args) %7B%0A    Strategy strategy1 = new ConcreteStrategy1();%0A    Context context = new Context(strategy1);%0A%0A    context.doAnything();%0A%7D%0A

add strategy pattern