问题描述
- properties存储元素的方法
-
public class properties {
public static void main(String[] args) {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("config.properties");
Properties pro = new Properties();try { pro.load(is); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } String da =pro.getProperty("12 ", "defaultValue"); String d1a = pro.getProperty("12"); System.out.println("d1a ="+d1a); }
时间: 2024-12-27 10:15:50