What is transient variable?

By: Karthik  

Answer: 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.

Archived Comments

1. Brettkip
View Tutorial          By: Brettkip at 2017-07-23 22:06:40

Most Viewed Articles (in Interview )

Latest Articles (in Interview)

Comment on this tutorial