• properties是一个Map体系的集合类
      • public class Properties extends Hashtable
    • 为什么在IO流部分学习Properties
      • Properties中有跟IO相关的方法
    • 当做双列集合使用
      • 不需要加泛型 , 工作中只存字符串
        1. public class PropertiesDemo1 {
        2. public static void main(String[] args) {
        3. // 创建集合对象
        4. Properties properties = new Properties();
        5. // 添加元素
        6. properties.put("it001" , "张三");
        7. properties.put("it002" , "李四");
        8. properties.put("it003" , "王五");
        9. // 遍历集合 : 键找值
        10. Set<Object> set = properties.keySet();
        11. for (Object key : set) {
        12. System.out.println(key + "---" + properties.get(key)); } System.out.println("========================");
        13. // 遍历集合 : 获取对对象集合 , 获取键和值
        14. Set<Map.Entry<Object, Object>> set2 = properties.entrySet(); for (Map.Entry<Object, Object> entry : set2) {
        15. Object key = entry.getKey();
        16. Object value = entry.getValue();
        17. System.out.println(key + "---" + value);
        18. }
        19. }
        20. }