| |
GeekInterview.com > Interview Questions > J2EE > Java
| Print | |
Question: what is a transient variable
Answer: A transient variable is a variable that may not be serialized. |
| June 06, 2005 12:50:44 |
#2 |
| Mark |
Member Since: Visitor Total Comments: N/A |
RE: what is a transient variable |
Declaring a Transient Variable You use the transient keyword to indicate to the Java virtual machine that the indicated variable is not part of the persistent state of the object. Variables that are part of the persistent state of an object must be saved when the object is archived. At this time, the transient marker is ignored by the Java runtime system. Future releases of the Java system will use the transient marker to implement various object archiving functions. Like other variable modifiers in the Java system, you use transient in a class or instance variable declaration like this: This statement declares an integer variable named hobo that is not part of the persistent state of the TransientExample class. |
| |
Back To Question | |