<qhelp>

<overview>

The `transient` modifier is used to identify fields that are not part of the persistent state of the class. As such, it only has an effect if the class is serializable, and has no purpose in a non-serializable class.

A field that is marked `transient` in a non-serializable class is likely to be a leftover from a time when the class was serializable.

</overview> <recommendation>

If the class is non-serializable, leave out the `transient` modifier. Otherwise, use the modifier, and ensure that the class (or a relevant supertype) implements `Serializable`.

</recommendation> <example>

The following example shows two fields that are declared `transient`. The modifier only has an effect in the class that implements `Serializable`.

</example> <references>

- Java Language Specification, 3rd Ed: 8.3.1.3 transient Fields.
- Java 6 Object Serialization Specification: 1.5 Defining Serializable Fields for a Class.
</references> </qhelp>