·The keyword transient in Java used to indicate that the variable should not be serialized By default all the variables in the object is converted to persistent state.
·In some cases, you may want to avoid persisting some variables because you don’t have the necessity to transfer across the network. So, you can declare those variables as transient.
·If the variable is declared as transient, then it will not be persisted. It is the main purpose of the transient keyword.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
· transient keyword is used when we are Serializing an object.
· The keyword transient in Java used to indicate that the variable should not be serialized By default all the variables in the object is converted to persistent state.
· In some cases, you may want to avoid persisting some variables because you don’t have the necessity to transfer across the network. So, you can declare those variables as transient.
· If the variable is declared as transient, then it will not be persisted. It is the main purpose of the transient keyword.