1. Using the Load () method of the Java.util.Properties class
Example: InputStream in = Lnew bufferedinputstream (new FileInputStream (name));
Properties P = new properties ();
p.load (in);
2. Using the Getbundle () method of the Java.util.ResourceBundle class
Example: ResourceBundle RB = Resourcebundle.getbundle (name, Locale.getdefault ());
3. Use the constructor of the Java.util.PropertyResourceBundle class
Example: inputstream in = new Bufferedinputstream (new FileInputStream (name));
ResourceBundle RB = new propertyResourceBundle (in);
4. The getResourceAsStream () method using the class variable
Example: InputStream in = JProperties.class.getResourceAsStream (name);
Properties P = new properties ();
p.load (in);
5. The getResourceAsStream () method of Java.lang.ClassLoader obtained using Class.getclassloader ()
Example: InputStream in = JProperties.class.getClassLoader (). getResourceAsStream (name);
Properties P = new properties ();
p.load (in);
6. Using the Getsystemresourceasstream () static method of the Java.lang.ClassLoader class
Example: InputStream in = Classloader.getsystemresourceasstream (name);
Properties P = new properties ();
p.load (in);
Supplement
the getResourceAsStream () method of Javax.servlet.ServletContext can be used in Servlets
Example: InputStream in = context.getresourceasstream (path);
Properties P = new properties ();
p.load (in);
Six ways Java loads the properties file