Difference between the transient and volatile variable in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Difference between the transient and volatile variable in Java?

Difference between the transient and volatile variable in Java?

21st May 2019, 7:10 PM
TheEngineerIN
TheEngineerIN - avatar
1 Answer
+ 4
Akshay Biradar Both transient and volatile modifiers are completely different to each other. Main difference between transient vs volatile variable is that transient variables are not serialized during Serialization process in Java while volatile variables are used to provide alternative synchronization in Java. source: http://www.java67.com/2012/11/difference-between-transient-vs-volatile-modifier-variable-java.html?m=1 I hope I was helpful
21st May 2019, 8:29 PM
Alessio Benvenuti
Alessio Benvenuti - avatar