• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

deserialization.....

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone explain me the procedure(internal things) when an object is serializied and deserialzed when super class is not serialized?



[ November 10, 2008: Message edited by: Ganeshkumar cheekati ]
 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Ganeshkumar cheekati
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got it thanks srilatha....
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

when i serialize sub class i need to serialize super class also.

eg: vlass A{}
class B extends A{}

when i serialize B then A also need to serialize.

Thanks in Advance
 
Fire me boy! Cool, soothing, shameless self promotion:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic