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


BOOKMARK THIS : del.icio.us | Digg it | Furl | reddit |


Related Questions :

  • Java Questions based on Object Serialization
  • How many methods in the Serializable interface? Which methods of Serializable interface should I implement?There is no method in the...
  • What happens to the static fields of a class during serialization?
  • There are three exceptions in which serialization doesnot necessarily read and write to the stream. These are 1. Serialization ignores static...
  • When you serialize an object, what happens to the object references included in the object?
  • The serialization mechanism generates an object graph for serialization. Thus it determines whether the included object references are serializable or...
  • Can a nested object be used in Serialization ?
  • Yes. If a class that is to be serialized contains references to objects of other classes, and if those classes...
  • Can I customise the serialization process?
  • Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example,...
  • What is the common usage of serialization?
  • Whenever an object is to be sent over the network, objects need to be serialized. Moreover if the state of...
  • Explain the difference between MyISAM Static and MyISAM Dynamic.
  • In MyISAM static all the fields have fixed width. The Dynamic MyISAM table would include fields such as TEXT, BLOB,...
  • How do I serialize an object to a file?
  • The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the...
  • What is conversational state
  • The field values of a session bean plus the transitive closure of the objects reachable from the bean's fields. The...
  • Why do you need to serialize.?
  • We need to serialize the object,if you want to pass object from oneĀ computer/application domain to another.Process of converting...

    Comments are closed.