This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
This isn't too difficult. When writing the objects to a file you need to make sure that their integrity as java objects is retained. This is done through serialization. An object that is serializable can be successfully serialized (converted to a serial format) and unserialized. To write an object to a file, all you need to do is something like this:
To read the object from the file you just do the opposite:
That's all there is to it!
Originally posted by Anish Yadav: Can anyone tell me how to store a object into a file and later on restore it.
[This message has been edited by Matt Senecal (edited April 30, 2001).] [This message has been edited by Matt Senecal (edited April 30, 2001).]
There's nothing more dangerous than a resourceful idiot. ---Dilbert