Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Conrad Evans   on Dec 28 In Java Category.

  
Question Answered By: Utsav Shah   on Dec 28

problem is in your empty-argument constructor. when you serialize the object, '10' is stored for 'i'. but when deserialized it automatically calls the empty argument constructor to rebuild the object. thats why you get value '20'. add another non-empty-constructor as follows:
public a(int y){
i+=10;
}
and modify your empty constrctor
public a(){}

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Serilazation Or get search suggestion and latest updates.


Tagged: