01: import java.io.*;
02: 
03: /**
04:    A program that serializes and deserializes a car.
05: */
06: public class SerializeCarTester
07: {
08:    public static void main(String[] args)
09:          throws IOException, ClassNotFoundException
10:    {
11:       Car beemer = new Car(100, 100, 60);
12:       System.out.println(beemer);
13:       ObjectOutputStream out = new ObjectOutputStream(
14:             new FileOutputStream("fleet.dat"));
15:       out.writeObject(beemer);
16:       out.close();
17:       ObjectInputStream in = new ObjectInputStream(
18:             new FileInputStream("fleet.dat"));
19:       System.out.println(in.readObject());
20:       in.close();
21:    }
22: }