Properties
含义
继承Hashtable,一般用来读取配置文件。
。
。
db.properties
driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1:3306/mytabis
username=root
password=root
``
。
`
_05Properties.java
public class _05Properties {
//体系结构
//Map
//Hashtable
//Properties
//含义:
//是继承Hashtable,主要用来读取配置文件(xx.properties)
public static void main(String[] args) throws IOException {
Properties properties = new Properties();
InputStream inStream = _05Properties.class.getClassLoader().getResourceAsStream("db.properties");
properties.load(inStream);
//properties.keySet()
Enumeration<Object> keyEnum = properties.keys();
while(keyEnum.hasMoreElements()) {
String key = keyEnum.nextElement()+"";
System.out.println(key+"==="+properties.getProperty(key));
}
}
}