can anyone explain me the procedure when an object is serializied and deserialzed when super class is not serialized?
When an object of a class is serialized and its super class is not serializable, all the instance variables inherited from super class are not serialized!
When the object is deserialized, the data owned by the subclass will be restored and inherited ones will be given the default values as in the case of creating a new object.
If we take the example given above, Dog is a serializable class where as its super class Animal is not. So the inherited "name" will have the default value "Animal", when an object of Dog is deserialized.
Actually the constructor of Animal class will be invoked during deserialization.
Constructor of the first non-serializable class in the inheritance tree will be called.
Every constructor ABOVE that non-serializable class constructor will
also run, no matter what, because once the first super constructor is invoked, it of
course invokes its super constructor and so on up the inheritance tree. Hope this is clear!
[ November 10, 2008: Message edited by: M Srilatha ]