Transient and volatile

August 24, 2007 9:59am CST
Can you define me what is Transient and volatile modifiers?
1 response
• India
22 Sep 07
transient is like an opposite of serializable. it means that when the object is serialized the members which have been marked as transient won't be saved. volatile has to do with system optimization...the runtime caches values of some variables. this can lead to inconsistent read-writes in mutli-threaded applications. in order to avoid this we dclare a variable to be volatile which infrms the java runtim that it must not cache the vaiable.