I read
java serialization doesn't include static variable's data. But when i run the following java file it does. It retains the value of the static variable. Can anyone explain why
Code
Output :
Before Serialization :x : 8, y :20
ABCfter Serialization :x : 0, y :20
If you observe the static variable y before serialization is initialized to 9 and later changed to 20 in constructor. After serialization is done. Now Deserializing the class shouldn't retain the static variable content according to my assumption : "java serialization doesn't include static variable's data". Why is this happening.