HTML

Difference between transient vs volatile variable or modifier in Java

transient vs volatile modifier in Java
What is the difference between transient and volatile variables or modifiers in Java is one of the most common Serialization Interview Questions in Java. Though volatile variables are not related to Serialization at all, this question is mostly asked in conjunction with other Serialization questions. Both transient and volatile modifiers are completely different from each other. In fact, this question is as popular as Serializable vs Externalizable in Java. The main difference between transient vs volatile variables is that transient variables are not serialized during the Serialization process in Java while volatile variables are used to provide alternative synchronization in Java.