InputStream is =
this.getClass().getClassLoader().getResourceAsStream(
"foo.properties");//foo.properties 是一个文件名,同此类放在同一目录下。Properties props = new Properties();
try {
props.load(is);
String value = (String)props("hello");
System.out.println("Value of hello is: " + value);} catch (IOException e) {
System.err.println("Load failed");
}我想写一个小例子程序,引用以上的code snippit,能运行就行。请帮忙。
this.getClass().getClassLoader().getResourceAsStream(
"foo.properties");//foo.properties 是一个文件名,同此类放在同一目录下。Properties props = new Properties();
try {
props.load(is);
String value = (String)props("hello");
System.out.println("Value of hello is: " + value);} catch (IOException e) {
System.err.println("Load failed");
}我想写一个小例子程序,引用以上的code snippit,能运行就行。请帮忙。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货