R08.java

import java.io.*;

/**
Program demonstrates object serialization.
*/
public class R08
{
    public static void main(String argv[])
    {
        try {
            ObjectInputStream istream = 
                new ObjectInputStream(
                    new FileInputStream("w08.dat"));
            Object x1 = istream.readObject();
            Object x2 = istream.readObject();
            istream.close();
            System.out.println(x1);
            System.out.println(x2);
            }
        catch(IOException e1) {
            System.err.println("I/O error: " + e1);
            }
        catch(ClassNotFoundException e2) {
            System.err.println("Class error: " + e2);
            }
    }
}