首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

原来这么读取属性文件的内容呀

2012-12-22 
原来这样读取属性文件的内容呀public class SiteUrl {?public static String readUrl(String key){??Prope

原来这样读取属性文件的内容呀

public class SiteUrl {
?public static String readUrl(String key){
??Properties properties = new Properties();
??try {
???properties.load(SiteUrl.class.getClassLoader().getResourceAsStream("siteurl.properties"));
??} catch (IOException e) {
???e.printStackTrace();
??}
??return (String)properties.getProperty(key);
?}
}

热点排行