UNB/ CS/ David Bremner/ teaching/ java/ PVWriter2.java
import java.io.ObjectOutputStream;
import java.io.FileOutputStream;
public class PVWriter2{
    public static void main(String [] args)
        throws java.io.IOException {
        ObjectOutputStream out =
        new ObjectOutputStream(
              new FileOutputStream("people2.dat"));
        String [] names={"Bob", "Doug", "Mohona",
                         "Takeshi", "Wenjie"};
        for (int i=0; i<names.length; i++){
            out.writeObject(new Person(names[i],i));
        }
        out.flush();
    }
}