Home Answers Viewqa Java-Interview-Questions What happens to the static fields of a class during serialization?

 
 


samar
What happens to the static fields of a class during serialization?
1 Answer(s)      2 years and 6 months ago
Posted in : Java Interview Questions

What happens to the static fields of a class during serialization?

View Answers

November 13, 2010 at 3:53 PM


Hi,

Here is the answer,

There are three exceptions in which serialization doesn?t necessarily read and write to the stream. These are

  1. Serialization ignores static fields, because they are not part of any particular state.
  2. Base class fields are only handled if the base class itself is serializable.
  3. Transient fields.









Related Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.