下面的代码是对resource.properties文件进行读操作:
InputStream input= this.getClass().getClassLoader().getResourceAsStream("resource.properties");
try{
props.load(input);
}catch(Exception e){
System.err.println("CheckLogin:不能读取属性文件. " + "请确保resource.properties在CLASSPATH指定的路径中");
}
this.midaUser = props.getProperty("User");
this.midaPassword = props.getProperty("Password");
即分别读取该文件中User和Password的值,现在想对User和Password的值进行修改
本文介绍了一种使用Java的Properties类来读取resource.properties文件的方法,并讨论了如何获取特定的配置值,如User和Password。
551

被折叠的 条评论
为什么被折叠?



