Core Java Interview Questions-Serialization and Deserialization
This Core Java Interview Questions-Serialization and Deserialization page provides all the java interview questions about serialization and deserialization and explaining about object streams, marker interfaces, data tags, serializable files and much more.
What are Object streams ?
Used to process information of Objects in java application.
What are the object stream classes in java API?
ObjectInputStream and ObjectOutputStream classes used to process Object data.
What is Serialization?
Serialization is the process of writing object information into the file as binary information.
What is a Serializable interface?
To serialize an Object, the class must implement Serializable interface.
What is De-Serialization?
De serialization is the concept of converting the serializable file into Object.
What is transient variable?
the transient variable will not participate in the process of serialization.
Confidential data members can be declared as transient variables.
What is .ser File?
.ser is the extension of the serializable file.
It contains binary information of the Serializable object.
Why can’t we collect serialized data into a text file?
We can serialize the data into text file also, but we get confused when we combine serialized file with
general text files.
Can we serialize an Object without implementing Serializable interface?
No, it throws NotSerializableException
What is Marker interface?
Marker interface doesn’t have specifications.
Marker interface is also called tagged interface.
What is data tag in java?
Marker interface is working like data tag and provides information about the object to be serialized.
Can we serialize an Object which is addressing to a Non-serialized object?
No, it raises NotSerializable Exception