Transient keyword:
When we have a class which implements Serializable interface,
that means its eligible for getting serialized but we want few fields not to get
serialized then we can place the transient keyword before their declarations to
tell the serialization mechanism that the field should not be saved along with
the rest of that object's state. Then those transient fields will not be
serialized. That means their values will not be saved into bytestream while
serialization and when deserialization, those transient fields will be stored back
into the object with their default values.
For example,