2 wan d wan_d 于 2013.07.01 20:47 提问

properties存储元素的方法

public class properties {
public static void main(String[] args) {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("config.properties");
Properties pro = new Properties();

    try {
        pro.load(is);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    String da =pro.getProperty("12 ", "defaultValue");

    String d1a = pro.getProperty("12");
    System.out.println("d1a ="+d1a);
}
Csdn user default icon
上传中...
上传图片
插入图片