Searching for "serialization"

Q:

What is the common usage of serialization? What exceptions occur during serialization?

Answer

The object need to be serialized when it’s sent over a network and when it’s state is saved. Exceptions which occur during serialization are:


a. transient fields


b. when the base class is serialized then only base class fields are handled.


c. static fields are ignored because they are not part of any state.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

Q:

Which key word is to be used to tell the JVM to skip the variable while performing the serialization process of the object containing it?

A) Transcient B) Volatile
C) Static D) Final
 
Answer & Explanation Answer: A) Transcient

Explanation:

If you mark an instance variable as transient, you're telling the JVM to skip (ignore) this variable when you attempt to serialize the object containing it.

Report Error

View Answer Report Error Discuss

Filed Under: Java