3.[研磨设计模式笔记]单例模式

  • 时间:
  • 浏览:0
  • 来源:大发彩神app—大发彩神8苹果版

}

    }

            in = AppConfig.class.getResourceAsStream(

        InputStream in = null;

    }

}

    }

            }

        return instance;

    public String getParameterB() {

    }

    private String parameterB;

            this.paramterB = p.getProperty(“paramB”);

    private String parameterA;

        catch(Exception e) {

            try {

    private void readConfig() {

        readConfig();

        try {

    }

    public String getParameterA() {

            this.paramterA = p.getProperty(“paramA”);

    }

        finally {

    private AppConfig() {

                        “AppConfig.properties”);

    public static void main(String[] args) {

        String paramB = config.getParameterB();

    public static AppConfig() getInstance() {

                in.close();

public class Client {

        return parameterA;

public class AppConfig {

        }

        return parameterB;

        String paramA = config.getParameterA();

            catch(Exception e) {

            p.load(in);

        Properties p = new Properties();

        AppConfig Config = AppConfig.getInstance();

    private static AppConfig instance = new AppConfig();