Java Properties.store(OutputStream out, String comments)

Syntax

Properties.store(OutputStream out, String comments) has the following syntax.

public void store(OutputStream out,  String comments)  throws IOException

Example

In the following code shows how to use Properties.store(OutputStream out, String comments) method.


/*  w w w  .  j  a v a2s. c o m*/
import java.util.Properties;

public class Main {

  public static void main(String[] args) throws Exception {
    Properties prop = new Properties();

    prop.setProperty("Chapter Count", "200");
    prop.put("Tutorial Count", "1500");
    prop.put("tutorial", "java2s.com");
    
    // print the list
    System.out.println(prop);

    // store the properties list in an output stream
    prop.store(System.out, "Main");

  }
}

The code above generates the following result.