Java 配置文件加載

Properties prop = new Properties();
prop.load(new InputStreamReader(Object.class.getResourceAsStream("/test.properties"), "UTF-8"));

String name = prop.get("USER_NAME").toString();
String email = prop.get("USER_EMAIL").toString();

System.out.println(name + ":" + email);


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章