The role of the Java transient keyword is to implement the Serilizable interface, add the keyword transient before the serialized property, and serialize the object without serializing it to the specified destination.
Transient usage Summary
1) Once the variable is transient modified, the variable will no longer be part of the object persistence, and the variable content cannot be accessed after serialization.
2) The Transient keyword can only modify variables, not methods and classes. Note that local variables cannot be modified by the transient keyword. If the variable is a user-defined class variable, the class needs to implement the serializable interface.
3) Variables modified by the Transient keyword can no longer be serialized, and a static variable cannot be serialized, whether or not it is transient modified.
The role of transient in Java