import java.io.*;
public class ObjectOutputTest implements Serializable {
  
  private String message;
  
  public ObjectOutputTest(String message) {
    setMessage(message);
    System.out.println("I am being constructed with a message!");
  }
  
  public String getMessage() { return message; }
  
  public void setMessage(String message) { this.message = message; }
  
  public static void main(String[] args) {
    ObjectOutputStream oos = null;
    try {
      oos = new ObjectOutputStream(
              new FileOutputStream("test.ser"));
      oos.writeObject(new ObjectOutputTest("Hello World!"));
    } 
	catch (IOException ex) {
      ex.printStackTrace();
    } 
  }
}