Today I try to store an Object
using java.util.properties
. I see many example just use String
or Integer
. Here is an example:
public static void main(String[] args) {
Properties prop = new Properties();
// add some properties
prop.setProperty("Height", "200");
prop.put("Width", "1500");
// print the list
System.out.println("" + prop);
try {
// store the properties list in an output stream
prop.store(System.out, "config.properties");
} catch (IOException ex) {
ex.printStackTrace();
}
}
So is it possible to store an Object
in properties
file or xml
file?