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

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();
        }
    }
}

原文地址:https://www.cnblogs.com/vonk/p/3961319.html