Transient Modifier

Transient Keyword

transient is a modifier applicable only for variables. It is mainly used in the serialization process.

During serialization, if we do not want to save the value of a particular variable (for security reasons), we should declare it as transient.

At the time of serialization, the JVM ignores the original value of the transient variable and stores only the default value in the file.

Hence, transient means "not to be serialized".

Transient Keyword Example

// In progress

0 Comments