What is transient variable?

Q

What is transient variable?

✍: Guest

A

Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the value of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null.

2013-03-29, 2011👍, 0💬