继承于hashtable,是线程安全的键值对存储结构
可保存在流中或从流中加载
只能保存字符串的键值对
public static void main(String[] args){
Properties prop = new Properties();
prop.setProperty("name", "zhangsan");
prop.setProperty("age", "10");
}
将Properties存入到文件中
PrintWriter pw = null;
try{
pw = new printWriter("out.txt");
prop.list(pw);
}catch(IOException e){
e.printStackTrace();
}finally{
if(pw != null){
pw.close();
}
}
网友评论