Java static serialization rules?

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 … Read more

Why does Java have transient fields?

The transient keyword in Java is used to indicate that a field should not be part of the serialization (which means saved, like to a file) process. From the Java Language Specification, Java SE 7 Edition, Section 8.3.1.3. transient Fields: Variables may be marked transient to indicate that they are not part of the persistent … Read more