@@ -0,0 +1,970 @@
+// --------------------- man%0A%0Apublic interface Man %7B%0A    void talk();%0A%7D%0A%0Apublic class WhiteMan implements Man %7B%0A    public void talk() %7B%0A        System.out.println(%22WhiteMan talking%22);%0A    %7D%0A%7D%0A%0Apublic class BlackMan implements Man %7B%0A    public void talk() %7B%0A        System.out.println(%22BlackMan talking%22);%0A    %7D%0A%7D%0A%0A// --------------------- man factory%0A%0Apublic interface ManFactory %7B%0A    Man create();%0A%7D%0A%0Apublic class WhiteManFactory implements ManFactory %7B%0A    public Man create() %7B%0A        return new WhiteMan();%0A    %7D%0A%7D%0A%0Apublic class BlackManFactory implements ManFactory %7B%0A    public BlackMan create() %7B%0A        return new BlackMan();%0A    %7D%0A%7D%0A%0A// --------------------- test code%0A%0Apublic static void main(String%5B%5D args) throws InterruptedException %7B%0A%09ManFactory blackFactory = new BlackManFactory();%0A%09ManFactory whiteFactory = new WhiteManFactory();%0A%0A%09Man blackMan = blackFactory.create();%0A%09Man whiteMan = whiteFactory.create();%0A%0A%09blackMan.talk();%0A%09whiteMan.talk();%0A%7D%0A

add factory method