Package advancejava; import static Java. lang. system. out; import Java. io. inputstream; import Java. lang. reflect. constructor; import Java. util. arraylist; import Java. util. collection; import Java. util. properties; public class propertiesload {/** U ** there are two ways to use the class loader to load the configuration file: 1. use the application class loader to load the configuration file. The loader starts searching for the path defined by Path 2. use * getresourceasstream of the current class to load the file. The loaded path is to search for */public static void main (string ARGs []) thro from the path of the current class. WS exception {// load ("advancejava/config. properties "); // load (" config. properties ");} public static void load (string properpath) throws exception {// inputstream in = // propertiesload. class. getclassloader (). getresourceasstream (properpath); // relative to the path inputstream in = propertiesload. class. getresourceasstream (properpath); // The path relative to the current class // find properties property = new properties (); property. load (in); s Tring classname = (string) property. get ("classname"); reflect (classname); In. close ();}/** instantiate an object using the obtained string class name, which relies on reflection. Can we instantiate the object accurately? */Public static void reflect (string classname) throws exception {collection Col = (Collection) class. forname (classname ). newinstance (); Col. add (1); Col. add (2); Col. add (3); out. println (Col. size ());}}