config.getInt("XXXX");这句怎么理解,主要是什么时候用到的??

解决方案 »

  1.   

    问题是你的config是啥东西??你就这样拿一句话说出来,别人怎么回答?   
      

  2.   

    getint 应该返回的是 一个int的把 
      

  3.   


    public class Config { private Properties cfg = new Properties(); public Config(String file) throws IOException { cfg.load(new FileInputStream(file));

    } public String getString(String key) {
    return cfg.getProperty(key);
    } public int getInt(String key) {
    return Integer.parseInt(cfg.getProperty(key));
    }这是config
      

  4.   

    return Integer.parseInt(cfg.getProperty(key));
    在Property中找出指定键对应的属性,然后转为int返回