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(){}