import java.io.*;
import java.util.*;
class Hello
{
public static void main(String[] args) throws Exception
{
Properties p = new Properties();
p.setProperty("name","sheldon");
p.setProperty("age","99");
p.setProperty("address","重庆市铜梁区");
File file1 = new File("D:" + File.separator + "code" + File.separator + "person.properties");
File file2 = new File("D:" + File.separator + "code" + File.separator + "person.xml");
p.store(new FileOutputStream(file1),"person info in txt");
p.storeToXML(new FileOutputStream(file2),"person info in xml");
Properties newP1 = new Properties();
newP1.load(new FileInputStream(file1));
System.out.println(newP1.getProperty("name"));
Properties newP2 = new Properties();
newP2.loadFromXML(new FileInputStream(file2));
System.out.println(newP2.getProperty("address"));
}
}