保存属性到普通的属性文件中

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

public class PropertiesDemo02 {
    public static void main(String[] args) {
        Properties pro = new Properties();
        pro.setProperty("BJ", "bEIJING");
        pro.setProperty("TJ", "TJIANJIN");
        pro.setProperty("DJ", "TOKYO");
        File file = new File("E:" + File.separator + "area.properties");
        try {
            pro.store(new FileOutputStream(file), "ARea Info");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

posted @ 2014-09-08 13:54  塔斯曼  阅读(178)  评论(0编辑  收藏  举报