Properties数据读取

package IO.file.test;

import java.util.Properties;
import java.util.Set;

public class PropertiesDemo {
    public static void main(String[] args) {
        
        Properties pro=new Properties();
        pro.setProperty("zhangsan", "30");
        pro.setProperty("lisi", "32");
        pro.setProperty("maer", "34");
        pro.setProperty("mazi", "45");
        pro.setProperty("wangwu", "12");
        //修改值
        pro.setProperty("mazi", "22");
        Set<String> names=pro.stringPropertyNames();
        for(String name:names){
            String value=pro.getProperty(name);
            System.out.println(name);
        }
    }

}

posted on 2012-10-19 22:01  蝌蚪的精神  阅读(110)  评论(0编辑  收藏  举报

导航