java.util.Properties - set a default value
Hi,
the following code shows the problem. I read in a properties file which has
the entry:
KeyA=
Now, i want to give out the default value, if no value is set as it is the case above. But the output is nothing. What磗 the problem and how to solve it?
import java.io.*;
import java.util.*;
publicclass Test{
public Test(){
test();
}
privatevoid test(){
Properties props =new Properties();
try{
props.load(new FileInputStream("props.properties"));
}catch(IOException ioe){ioe.printStackTrace();}
System.out.println(props.getProperty("KeyA","defaultValue"));
}
publicstaticvoid main(String args[]){
new Test();
}
}
Thanks for answers in advance!

