Properties类:
Hashtable的子类,主要功能是用于操作属性,作为配置文件。
特点:按照“key=value”的形式保存,保存的内容都是String,用#进行注释
常用载入Properties文件的方法如下:
private static Properties p = null;
private static String RESOURCE_PATH = "demo.properties";
static{
p = new Properties();
InputStream in = null;
try {
in = Thread.currentThread().getContextClassLoader().getResourceAsStream(RESOURCE_PATH);
p.load(in);
} catch (IOException e) {
e.printStackTrace();
}
}