Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Serialization and DeSerialization process

 
Raj chiru
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi....



My dout is which constructor is called during the deserialization process? Is class A is serialized automatically when Class B is serialized?
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raj chiru wrote:
My dout is which constructor is called during the deserialization process?


Very easy to have println statements in both the constructors and find out for yourself isn't it?
 
Raj chiru
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.....Maneesh
Thanks for your reply,

Just now i executed the programme,so constructor A() is called. but my dout is why constructor A() is called during deserialization process?what about class B constructor?
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a very nice article to explain serialization mechanism
http://java.sun.com/developer/technicalArticles/Programming/serialization/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic