What is Transient and volatile

Answer Posted / subrahmanyam

transient
identifies a variable not to be written out when an
instance is serialized (It can'nt be copied to remove
system)

volatile
indicates that the field is used by synchronized threads
and that the compiler should not attempt to perform
optimizations with it.

When more than one thread share a (volatile) data it is
checked every time. Every thread keeps the latest value of
volatile variable

Is This Answer Correct ?    30 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by default constructor in java?

582


What are the basics of core java?

554


Where is singleton pattern used?

532


What are the supported platforms by java programming language?

573


Can keyword be used as identifier?

550






What is the significance of continue jump statement? Explain with an example.

745


What is var keyword ?

742


What is memory leak and how does java handle it?

525


What is the advantage of OOP in java?

663


What is the default access specifier for variables and methods of a class?

570


Does java list allow null?

550


Why java is not 100% object-oriented?

837


What is the Concept of Encapsulation in OOPS

562


What are different types of expressions?

556


What causes memory leak in java?

484