Saibabaa Pragada wrote:Hi, this is from Exam Lab. I read that static variables do not participate in Serialization. But, here it participates in Serialization..Why ??
If you set b to something else, right before you deserialize, you will notice that it doesn't change -- it is still that something else. The value is two, not because of the deserialization, but because that is the value. Remember, there is only one copy of static variables, and if you don't change it, it won't change.
Henry