Properties的概述和作为Map集合的使用
- A:Properties的概述
- Properties 类表示了一个持久的属性集。
- Properties 可保存在流中或从流中加载。
- 属性列表中每个键及其对应值都是一个字符串。
- B:案例演示
- Properties作为Map集合的使用
package com.heima.otherio;
import java.io.IOException;
import java.util.Properties;
public class Demo10_Properties {
/**
* @param args
* Properties是Hashtable的子类
* @throws IOException
*/
public static void main(String[] args) throws IOException {
Properties prop = new Properties();
prop.put("abc", 123);
System.out.println(prop);
}