Static Serialization - Java

Statics are implicitly transient, so you don't need to declare them as such.
Serialization is for serializing instances, not classes. Static fields (methods are irrelevant since they are part of the class definition so they aren't serialized) will be reinitialized to whatever value they are set to when the class is loaded.
If you have a mutable static field, then the changes made to that value will be lost.

Comments

Popular posts from this blog

EJB - Stateful vs Stateless

Mirror binay tree - Java