Java.util.Properties.load(Reader reader) 方法


Java.util.Properties.load(Reader reader) 方法

package com.codingdict;

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

public class PropertiesDemo {
   public static void main(String[] args) {
      Properties prop = new Properties();
      String s = "Height=200\nWidth=15";

      // create a new reader
      StringReader reader = new StringReader(s);

      try {
         // load from input stream
         prop.load(reader);

         // print the properties list from System.out
         prop.list(System.out);
      } catch (IOException ex) {
         ex.printStackTrace();
      }
   }
}