Before getting to transient we must understand serialization as transient is a variable modifier which is used in serialization.
Serialization
Serialization is often described as a process in which the conversion of state of the object into byte stream takes place, while deserialization is the reverse process. This essentially makes the state of the object persistent. This is important in networking programming very much as the objects to be transmitted have to be converted into bytes.
Transient keyword and purpose
Now when the serialization takes place if we do not want to save value of specific variables then we can use transient. It also plays a vital role in security aspect of the variables, there are many cases when we do not want to save some sort of private data in the files to give them an extra layer of protection. It is considered a good programming practise to use transient with confidential fields of a class during serialization.