This code reads from a .properties
file
protected String cfgReader(String arg1)
throws IOException
{
String readVal = null;
FileInputStream in = new FileInputStream("CFG.properties");
Properties props = new Properties();
props.load(in);
readVal = props.getProperty(arg1);
in.close();
FileOutputStream out = new FileOutputStream("CFG.properties");
props.store(out, null);
out.close();
return readVal;
}
but if I try to do something like:
if(cfgReader("var1") == "n/a"){...}
it doesn't work even if the .properties
contains
var1=n/a