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

public class SerializeOut {

   public static void main (String args[]) throws IOException  {

       BunchOfRandoms b1 = new BunchOfRandoms();
       BunchOfRandoms b2 = new BunchOfRandoms();

       ObjectOutputStream out = 
           new ObjectOutputStream (
              new FileOutputStream("objects.dat"));

       Date now = new Date(System.currentTimeMillis());
       out.writeObject(now);
       out.writeObject(b1);
       out.writeObject(b2);
       out.close();
       System.out.println("I have written:");
       System.out.println("A Date object: "+now); 
       System.out.println("Two bunchs of randoms");
       b1.printout();
       b2.printout();
   }
}
