1.读取配置文件

try{
 File f=new File("D:\\myfile.text");
 Properties pp=new Properties();
 FileInputStream fis = new FileInputStream(f);
 pp.load(fis);
}catch(Exception ex){
}

  

 

2.修改配置文件

File f=new File("D:\\myfile.text");
Properties pp=new Properties();

pp.setProperty("001","I am a student!");
pp.setProperty("002","Me too!");

try {
FileOutputStream out = new FileOutputStream(f,true);

pp.store(out,"test");
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}