Tips for saving?
I recently decided to write an ATM simulator, and was wondering what the best method is to save the People objects I have created. They are in a linked list structure which I would also like to retain. Here is what I currently have to save and open the files.
public static void Save(Node<Person> head) throws IOException
FileOutputStream out = new FileOutputStream("save");
ObjectOutputStream Objout = new ObjectOutputStream(out);
//Let's write all the objects in the linked list to a file.
for(cursor = head; cursor != null; cursor = cursor.returnforward() )
and to open
It doesn't seem to throw any errors, but it doesn't load the saved files. Any help is appreciated.
public static void Open() throws IOException, ClassNotFoundException
FileInputStream in = new FileInputStream("save");
ObjectInputStream Objin = new ObjectInputStream(in);
Person obj = (Person)Objin.readObject();
int id = Objin.read();