package com.tutego.insel.util.map;

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

class SaveProperties
{
  public static void main( String[] args )
  {
    Writer writer = null;
    
    try
    {
      writer = new FileWriter( "properties.txt" );
    
      Properties p1 = new Properties( System.getProperties() ); 
      p1.setProperty( "MeinNameIst", "Forrest Gump" );
      p1.store( writer, "Eine Insel mit zwei Bergen" );
    
      Reader reader = new FileReader( "properties.txt" );
    
      Properties p2 = new Properties();
      p2.load( reader );
      p2.list( System.out );
    }
    catch ( IOException e )
    {
      e.printStackTrace();
    }
    finally
    {
      try { writer.close(); } catch ( IOException e ) { }
    }
  }
}