Object readObject()
ObjectInputStream class extends the InputStream class and implements the ObjectInput interface.
Serialization is the process of writing the state of an object to a byte stream. This is used when you want to save the state of your program to persistent storage area.
ObjectOutput interface extends the DataOutput interface and supports object serialization.
Serialization and deserialization occur automatically by java run time system, Garbage collection also occur automatically but is done by CPU or the operating system not by the java run time system.
Externalization
flush()
ObjectInput interface extends the DataInput interface and supports object serialization.
Serialization, deserialization and Memory allocation occur automatically by java run time system.
Deserialization is a process by which the data written in the stream can be extracted out from the stream.