public static void main(String[] args) {
File f = new File("D://workspace//jta//t.properties");
Thread t = new Thread();
t.start();
Properties p = new Properties();
try {
InputStream in = new FileInputStream(f);
p.load(in);
String value = p.getProperty("ids");
System.out.println("before value is=="+value);
in.close();
OutputStream out = new FileOutputStream(f);
p.setProperty("ids", "1123");
p.store(out, "Update value");
System.out.println("after value is -==="+p.getProperty("ids"));
out.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Thread t1 = new Thread();
try {
InputStream in = new FileInputStream(f);
p.load(in);
String value = p.getProperty("ids");
System.out.println("value is==>"+value+"==========");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
t1.start();
}
properties修改
最新推荐文章于 2022-01-15 19:08:43 发布