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.


Java Code:
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. 
		
		Node<Person> cursor; 
		for(cursor = head; cursor != null; cursor = cursor.returnforward() )
		{
		Objout.writeObject(cursor.returnData()); 
		} 
		

	}

and to open

Java Code:
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();
		
		AddToList(obj); 
	}

}
It doesn't seem to throw any errors, but it doesn't load the saved files. Any help is appreciated.