62,614
社区成员
发帖
与我相关
我的任务
分享
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class PropertiesTest {
public static void main(String[] args) {
InputStream is = PropertiesTest.class.getClassLoader()
.getResourceAsStream("config.properties");
Properties prop = new Properties();
try {
prop.load(is); // 错误指到这里,但是搞不懂是什么原因
String name = prop.getProperty("name");
String pwd = prop.getProperty("pwd");
System.out.println("name:" + name + "pwd" + pwd);
} catch (IOException e) {
e.printStackTrace();
}
}
}