Java Properties.list(PrintWriter out)

Syntax

Properties.list(PrintWriter out) has the following syntax.

public void list(PrintWriter out)

Example

In the following code shows how to use Properties.list(PrintWriter out) method.


/*from w ww .  j av  a  2  s . c  o m*/
import java.io.PrintWriter;
import java.util.Properties;

public class Main {

  public static void main(String[] args) throws Exception {
    Properties prop = new Properties();
    PrintWriter writer = new PrintWriter(System.out);


    prop.put("Chapter Count", "200");
    prop.put("Tutorial Count", "150");
    prop.put("tutorial", "java2s.com");
    prop.put("Runnable", "true");

    // print the list with a PrintWriter object
    prop.list(writer);

    // flush the stream
    writer.flush();

  }
}

The code above generates the following result.