Let's say that I create an instance of class B, which has an static variable x, assigned with a value of 3 in the class B declaration. In the main() method, I do this:
B b = new B();
b.x = 7; //allowed to use an instance to set the static member value
After this, b is serialized and then de-serialized. Then, the following line occurs:
System.out.println ("static: " + b.x);
What's the value? 7 or 3?
I know static variables are not serialized, however, since there is only one copy of the static member for the whole class, and the value is set to 7, should it be preserved after de-serializing an instance?