package p;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;
public class PRO {
public static void writeProperties(String filePath) {
Properties prop = new Properties();
try {
OutputStream fos = new FileOutputStream(filePath);
prop.setProperty("age", "12");
prop.setProperty("name", "张三");
prop.setProperty("adress", "北京");
prop.setProperty("adress2", "北京2");
// 以适合使用 load 方法加载到 Properties表中的格式,
// 将此 Properties 表中的属性列表(键和元素对)写入输出流
prop.store(fos, "");
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
writeProperties("D:/wwww/work/ROOT/src/p/a.properties");//路径
System.out.println("OK");
}
}