一、文件样式:
二、config.default.properties中的内容:
三、操作代码
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static String getValue(Properties properties,String key)
{
if(properties.containsKey(key))
{
String value = properties.getProperty(key);
return value;
}
else
{
return "";
}
}
public static void clear(Properties properties)
{
properties.clear();
}
public static void setValue(Properties properties,String key,String value)
{
properties.setProperty(key,value);
}
}
四、输出结果: