What is a transient variable in Java?
transient variable in Java is a variable whose
value is not serialized during Serialization and which is initialized by its
default value during deserialization, for example for object transient variable it would be null. This
behavior can be customized by using a custom Serialized form or by using the Externalizable
interface. A transient variable is used to prevent any
object from being serialized and you can make any variable transient by using the transient keyword. You cannot make a local variable transient through and it's only the member variables which can be transient.