src/creational1/abstractfactory/example1/Demo.java
/**
     * Application picks the factory type and creates it in run time (usually at
     * initialization stage), depending on the configuration or environment
     * variables.
     */
Application picks the factory type and creates it in run time (usually at
initialization stage), depending on the configuration or environment
variables.
Application picks the factory type and creates it in run time ( usually at initialization stage ) depending on the configuration or environment variables .
private static Application configureApplication() {
        Application app;
        GUIFactory factory;
        String osName = System.getProperty("os.name").toLowerCase();
        if (osName.contains("mac")) {
            factory = new MacOSFactory();
            app = new Application(factory);
        } else {
            factory = new WindowsFactory();
            app = new Application(factory);
        }
        return app;
    }
private static Application configureApplication ( ) { Application app ; GUIFactory factory ; String osName = System . getProperty ( "os.name" ) . toLowerCase ( ) ; if ( osName . contains ( "mac" ) ) { factory = new MacOSFactory ( ) ; app = new Application ( factory ) ; } else { factory = new WindowsFactory ( ) ; app = new Application ( factory ) ; } return app ; }
Application picks the factory type and creates it in run time (usually at
 initialization stage), depending on the configuration or environment
 variables.
Application picks the factory type and creates it in run time ( usually at initialization stage ) depending on the configuration or environment variables .