Properties:
|-------Hashtable:古老的实现类,线程安全,不建议使用
|------Properties:常用来处理属性文件,键值对都是String类型的
代码示例:
//使用Properties处理属性文件 @Test public void test6() throws IOException { Properties pros = new Properties(); pros.load(new FileInputStream(new File("jdbc.properties"))); String user = pros.getProperty("user"); System.out.println(user); String pwd = pros.getProperty("password"); System.out.println(pwd); }
结果:
root
123abc