How to store and retrieve serialized objects to and from a file in Java?

How to store and retrieve serialized objects to and from a file in Java?

The object’s current state can be persisted and retrieved by using the concept known as ‘serialization’. This is done on an object to a stream. The stream would function as a container for the object. The persistent container, like a file on disk, allows the data of an object to be stored after the current session is completed. The interface ‘Serializable’ would support to perform the operations along with ObjectOutputStream and ObjectInputStream class objects. The method to write data is writeObject() and the method to retrieve object’s data is readObject().

What is relation between JAXP and Xerces? - Java
Xerces is a group of libraries for parsing, serializing, validating and manipulating XML...
What type of garbage collection does a System.gc() do? - Java
Among various types of garbage collections, the System.gc() performs an explicit collection of garbage calls. The other garbage collection types are:...
When do I need to use reflection feature in Java?
Reflection feature in java allows an executing java program for introspecting upon itself. It also allows for manipulating internal properties of the program...
Post your comment