What is Transient variable ?

By
Advertisement
Transient variable in java :- A transient variable is a variable that may not be serializable.
Or

A variable that won’t be allow for object serialization. So that the state of variable will always be defaulted after the deserilization.


For example a variable x has a default value is 0 and at serialization it may be assigned any value . when the serialization is completed it will be deserilized to it’s default value.

0 comments:

Post a Comment