package frank;
import java.lang.*;
import java.util.Properties;
import java.io.FileOutputStream;
import java.io.FileInputStream;
/**
* Properties的使用,Properties是Hashtable的一个子类
* */
public class App
{
public static void main(String[] args)throws Exception
{
Properties props = new Properties();
props.setProperty("UserName","yeeku");//添加属性到集合中
props.setProperty("PassWord","123456");
//将key-value保存到a.ini的文件中
props.store(new FileOutputStream("a.ini"),"Comment Line");
Properties props2 = new Properties();
props2.setProperty("gender","male");//添加
props2.load(new FileInputStream("a.ini"));//把a.ini文件中的key-value追加到后面
System.out.println(props2);
}
}