Properties.load(Reader reader) has the following syntax.
public void load(Reader reader) throws IOException
In the following code shows how to use Properties.load(Reader reader) method.
/*from www. j a va2s . co m*/ import java.io.StringReader; import java.util.Properties; public class Main { public static void main(String[] args) throws Exception { Properties prop = new Properties(); String s = "Chapter Count=200\nTutorial Count=15"; // create a new reader StringReader reader = new StringReader(s); // load from input stream prop.load(reader); // print the properties list from System.out prop.list(System.out); } }
The code above generates the following result.