Object graph in java serialization

 Object graph in Serialization

====================================

  • Whenever we are serializing an object, the set of all objects which are reachable from that object, will be serialize automatically. This group of object is nothing but Object Graph.
  • In object graph every object be serializable, if at least one object is not serializable then we will get runtime exception: NotSerializableException 
 
 
 
  •  In the above program whenever we  serialize Dog object, automatically Cat and Rat objects got serialized because these are part of object graph of Dog.
  • Among Dog, Cat and Rat objects, if at least one object is not serializable then we will get runtime exception: NotSerializableException

 
 
 
RAKESH RAKA

I am Rakesh Raka, senior software engineer (JAVA) in Sopra Steria.

Post a Comment (0)
Previous Post Next Post