Skip to content
Advertisement

Tag: transient

Java static serialization rules?

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? Answer statics are implicitly transient, so you don’t need to declare them as such. Serialization is for serializing instances,

Why does Java have transient fields?

Why does Java have transient fields? Answer 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

Advertisement