wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes deserialization constructor execution doubt. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "deserialization constructor execution doubt." Watch "deserialization constructor execution doubt." New topic
Author

deserialization constructor execution doubt.

Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

K&B page# 469
But these things do NOT happened when as object is deserialized, When an instance of a serializable class is deserializedthe constructor does not run...


They why following code giving output at the time of deserialization??


output is:
animal
dog
animal <= why its executing Animal class constructor at the time of desrialization???


SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
because Animal class doesnot implements serializable interface and it is rule that when an object is deserialized all the super classes that do not implement serializable interface will have there constructor run.


SCJP 1.6 96%
Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

Neha Daga wrote:because Animal class doesnot implements serializable interface and it is rule that when an object is deserialized all the super classes that do not implement serializable interface will have there constructor run.


thanks neha, then i might miss those lines from K&B.
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
serialization not on exam


scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deserialization constructor execution doubt.