Tuesday 17 January 2017

What is Transient?

The keyword transient in Java used to indicate that the variable is not serialized.

By default all the variables in the object is converted to persistent state. In some cases, you may want to avoid persisting some variables because you don’t have the necessity to transfer across the network.

For example, you may have fields that are derived from other fields, and should only be done so programmatically, rather than having the state be persisted via serialization.

No comments:

Post a Comment