What happens to the static fields of a class during serialization? Are these fields serialized as a part of each serialized object ?
Yes the static fields do get serialized. If the static field is an object then it must have implemented Serializable interface. The static fields are serialized as a part of every object. But the commonness of the static fields across all the instances is maintained even after serialization.
Explore posts in the same categories: Java Interview Questions