Properties props
=
new
Properties();
InputStream in
=
Main.
class
.getResourceAsStream(
"
p.properties
"
);
//
p.properties文件与当前类同包
props.load(in);
//
将配置文件内容加载到Properties对象中
BufferedReader input
=
new
BufferedReader(
new
InputStreamReader(System.in));
//
从屏幕接收用户输入
String key
=
input.readLine();
System.out.println(props.get(key);