Java Properties.load(Reader reader)

Syntax

Properties.load(Reader reader) has the following syntax.

public void load(Reader reader)  throws IOException

Example

In the following code shows how to use Properties.load(Reader reader) method.


/*from   w w w .j a v a 2 s .c  o  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.