Example & Tutorial understanding programming in easy ways.

Serialization is NOT save the value of static class attributes. Why static variables are not serialized?

The Java variables declared as static are not considered part of the state of an object since they are shared by all instances of that class. Saving static variables with each serialized object would have following problems

It will make redundant copy of same variable in multiple objects which makes it in-efficient.
The static variable can be modified by any object and a serialized copy would be stale or not in sync with current value.

Read More →