Previous | Next | Trail Map | Writing Java Programs | Java Objects


Declaring a Transient Variable

You use the transient keyword to indicate to the the Java virtual machine that the indicated variable is not part of the persistent state of the object. At this time, the Java virtual machine ignores the transient marker. 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

class TransientExample {
    transient int hobo;
    . . .
}
This statement declares an integer variable named hobo that is not part of the persistent state of the TransientExample class.


Previous | Next | Trail Map | Writing Java Programs | Table of Contents