meaning of description for constructor of property class
pFor property class we have the following as one of the constructors:/p
precodeProperties(Properties default) Creates an empty property list with
the specified defaults /code/pre pWhat does it mean by empty property list
with the specified defaults/p pI wrote a demo program to test what is
happening:/p precodeimport java.util.*; import java.io.*; public class
test { private static String z; private static String i; public static
void main(String [] args) throws FileNotFoundException, IOException{ z =
a; i = b; Properties p = new Properties(); p.setProperty(z,z);
p.setProperty(i,i); p.store(new FileOutputStream(r.txt), null); Properties
pp = new Properties(p); pp.store(new FileOutputStream(random.txt), null);
pp.load(new FileInputStream(in.txt)); pp.store(new
FileOutputStream(random1.txt), null); } } /code/pre pThe result were
coderandom.txt/code was empty, coderandom1.txt/code has codez=n/code. The
newly created property has no defaults as coderandom.txt/code is empty. So
what does the constructor description mean? Please correct me if I am
wrong somewhere./p
No comments:
Post a Comment