Java static serialization rules?

Viewed 28169

I'm working on a save state serialization with a few static methods and fields. I could have sworn though that serialization and static's caused mayhem. Should I make all static's transient? And will inflating the calls restore the statics as normal?

7 Answers

Static fields can never be a part of "ser" file. Static + transient is the same as transient.

Static belongs to class, Sterilization deals with object/instance.

Thus declaring static, it doesn't belong to object anymore and cannot be serialized.

Related