在Java中調用Properties對象通常使用以下方法:
Properties prop = new Properties();
prop.load(new FileInputStream("config.properties"));
String value = prop.getProperty("key");
System.out.println(value);
Properties prop = new Properties();
prop.setProperty("key", "value");
Properties prop = new Properties();
prop.load(new FileInputStream("config.properties"));
Set<Object> keySet = prop.keySet();
for(Object key : keySet) {
String value = prop.getProperty(key.toString());
System.out.println(key + " = " + value);
}