Serialization Interview Question

  • What is Serialization in Java?
  • Object Serialization in Java is a process used to convert Object into a binary format which can be persisted into disk or sent over network to any other running Java virtual machine; the reverse process of creating object from binary stream is called deserialization in Java.
    Java API -,, ObjectInputStream and ObjectOutputStream etc.
  • While serializing you want some of the members not to serialize? How do you achieve it?
  • If you don't want any field to be part of object's state then declare it either static or transient based on your need and it will not be included during Java serialization process.
  • How to make a Java class Serializable?
  • Making a class Serializable in Java is very easy, Your Java class just needs to implements interface and JVM will take care of serializing object in default format.
  • Serializable interface has no method then what zerialization happen?
  • Serializable interface exists in package and forms core of java serialization mechanism. It doesn't have any method and also called Marker Interface in Java. When your class implements interface it becomes Serializable in Java and gives compiler an indication that use Java Serialization mechanism to serialize this object.