• Post Reply Bookmark Topic Watch Topic
  • New Topic

serialization question

 
rajareddy annavaarm
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If class A does not implement Serializable but a subclass B implements Serializable, will the fields of class A be serialized when B is serialized?
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes
 
prakash chandra
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When you implements Serializable to a class, its super class variables are not serialized. But variables of its sub classes will be serialized automatically. When you deserialize a class whose super class does not implements Serializable then you will not get the actual values of super class's variables. You will get the current value.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!