Transient

Why Trust Techopedia

What Does Transient Mean?

In computer programming, in Java specifically, transient is a keyword that is used to indicate that a variable should not be serialized. By default, all variables in an object can be serialized and therefore become persistent, but if a specific variable does not require persistence for any reason, the transient keyword can be used to mark that variable so that it is not serialized when the code is compiled.

Techopedia Explains Transient

The transient keyword prevents a variable from becoming persistent. The latter means that a variable is turned into a stream of bytes and then stored in a file. This process is called serialization and is the default behavior for all variables in an object. Serialization is mostly relevant for network programming because an object that needs to be transmitted over a network needs to be converted into a series of bytes so that it can be sent in pieces; because of this every class and interface must be serializable by default. But if there is no requirement for network transport, the transient keyword can be used to mark a variable for exclusion when serialization takes place. This may save some computing resources and a tiny bit of processing time.

Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.