transient Keyword in Java

Java Programming Java 8Object Oriented Programming

An instance variable is marked transient to indicate the JVM to skip the particular variable when serializing the object containing it. This modifier is included in the statement that creates the variable, preceding the class or data type of the variable.

Example

public transient int limit = 55;   // will not persist
public int b;   // will persist
raja
Published on 19-Sep-2018 11:29:50
Advertisements