ContactUs :

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

What are transient and volatile modifiers?

When serializable interface is declared, the compiler knows that the object has to be handled so as so be able to serialize it. However, if you declare a variable in an object as transient, then it doesn’t get serialized.

 

Volatile

Specifying a variable as volatile tells the JVM that any threads using that variable are not allowed to cache that value at all.

Volatile modifier tells the compiler that the variable modified by volatile can be changed unexpectedly by other parts of the program.

 

Related Posts Plugin for WordPress, Blogger...
Flag Counter