// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;

public class Save {
    public static void main(String[] args) throws IOException {
        ArrayList<Data> lst = new ArrayList<Data>();
        lst.add(new Data(1, "A"));
        lst.add(new Data(2, "BB"));
        lst.add(new Data(3, "CCC"));
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("C:\\data.dat"));
        oos.writeObject(lst);
        oos.close();
    }
}
