好记性也记不住
代码
package com;
import java.io.InputStream;
import java.util.Properties;
public class PropertiesUtil {
public static void main(String[] args) {
Properties prop = new Properties();
InputStream is = null;
try {
is = PropertiesUtil.class.getClassLoader().getResourceAsStream("jdbc.properties");
//或者
//is = PropertyUtil.class.getResourceAsStream("/jdbc.properties");
prop.load(is);
} catch (Exception e) {
}
String s = prop.getProperty("name");
System.out.println(s);
}
}