基本介绍
package top.ltyzqhh.collection;
import java.util.Properties;
public class Properties_ {
public static void main(String[] args) {
//1.Properties 继承了 Hashtable
//2. 可以通过k-v存放数据,当然key和value 不能为null
//增加
Properties properties = new Properties();
properties.put("john",100);
properties.put("小明",100);
properties.put("哈哈",100);
properties.put("john",200);//如果有相同的key,value也是被替换
System.out.println(properties);
//通过k,获取对应值
System.out.println(properties.get("小明"));
//删除
properties.remove("小明");
System.out.println(properties);
//修改
properties.put("john","傻子");
System.out.println(properties);
}
}