This discussion is archived
1 Reply Latest reply: Aug 20, 2010 5:28 PM by EJP RSS

Adding a hashmap to already serialised class.

800453 Newbie
Currently Being Moderated
Hi,

I am having a serializable class A for some time in my project whose instances were serialized to a file in the past. Now I have added a new instance variable myMap which is of type HashMap to this class. In the constructor of class A i am initialising myMap as
 myMap = new HashMap
. When i deserialize old instances of class A, I am expecting the newly added instance variable myMap to be null. But I am getting it as a empty HashMap. Can anyone explain me what happens when i add new variable(HashMap) to already seriliazed instances.