What is transient variable
Answer : In java transient modifier used to handle somewhat specialized situations.If we don’t want the value to be seriallized then transient can be used.
When an instance variable is declared as transient, then its value need not persist when an object is stored.Please have an example below:
class TopClass { transient int i; // will not persist int j; // will persist }
Suppose, An object of type TopClass is written to a persistent storage area, then the contents of a transient variable “i” would not be saved, but the contents of int “j” would be saved.