@@ -0,0 +1,936 @@
+package creational;%0A%0A/**%0A * Created by %E6%9D%8E%E6%81%92%E5%90%8D on 2017/6/14.%0A * %3Cp%3E%0A * %E9%9D%99%E6%80%81%E5%B7%A5%E5%8E%82%E6%96%B9%E6%B3%95%E6%A8%A1%E5%BC%8F%EF%BC%8C%E5%87%86%E7%A1%AE%E6%9D%A5%E8%AE%B2%E8%BF%99%E5%B9%B6%E4%B8%8D%E6%98%AF%E4%B8%80%E7%A7%8D%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%EF%BC%8C%E5%8F%AA%E6%98%AF%E4%B8%BA%E4%BA%86%E7%AE%80%E5%8C%96%E5%88%9B%E5%BB%BA%E5%AF%B9%E8%B1%A1%E7%9A%84%E8%BF%87%E7%A8%8B%E3%80%82%0A * %E8%BF%99%E7%A7%8D%E5%88%9B%E5%BB%BA%E5%AF%B9%E8%B1%A1%E5%BD%A2%E5%BC%8F%E5%BE%88%E5%B8%B8%E8%A7%81%EF%BC%8C%E6%AF%94%E5%A6%82 Guava %E4%B8%AD%E7%9A%84 Lists %E3%80%81Maps %E7%AD%89%E3%80%82%0A */%0Apublic class StaticFactoryMethodPattern %7B%0A    //%E6%B1%BD%E8%BD%A6%E6%8A%BD%E8%B1%A1%0A    static abstract class Car %7B%0A        abstract void run();%0A    %7D%0A%0A    //%E5%A5%94%E9%A9%B0%E6%B1%BD%E8%BD%A6%0A    static class Benz extends Car %7B%0A        @Override%0A        void run() %7B%0A            System.out.println(%22%E5%A5%94%E9%A9%B0%E8%BD%A6%E5%9C%A8%E8%B7%91%22);%0A        %7D%0A    %7D%0A%0A    //%E5%AE%9D%E9%A9%AC%E6%B1%BD%E8%BD%A6%0A    static class BMW extends Car %7B%0A        @Override%0A        void run() %7B%0A            System.out.println(%22%E5%AE%9D%E9%A9%AC%E8%BD%A6%E5%9C%A8%E8%B7%91%22);%0A        %7D%0A    %7D%0A%0A    //%E6%B1%BD%E8%BD%A6%E5%B7%A5%E5%8E%82%0A    static final class CarFactory %7B%0A%0A        public static Benz getBeznCar() %7B%0A            return new Benz();%0A        %7D%0A        public static BMW getBMWCar() %7B%0A            return new BMW();%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Car car = CarFactory.getBeznCar();%0A        //Car car = CarFactory.getBMWCar;%0A        car.run();%0A    %7D%0A%7D%0A%0A

add > 静态工厂方法模式