Java.util.Properties.store(OutputStream out,String comments) 方法


Java.util.Properties.store(OutputStream out,String comments) 方法

package com.codingdict;

import java.io.IOException;
import java.util.*;

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

      // add some properties
      prop.setProperty("Height", "200");
      prop.put("Width", "1500");

      // print the list
      System.out.println("" + prop);

      try {
         // store the properties list in an output stream
         prop.store(System.out, "PropertiesDemo");
      } catch (IOException ex) {
         ex.printStackTrace();
      }
   }
}