What is Transient and volatile

Answer Posted / pasindu

Trsnsient:
If you mark an instance variable as transient you're telling
the JVM to skip this variable when you attempt to serialize
the object containing it.

Volatile:
The volatile modifier tells the JVM that a thread accessing
the variable must always reconcile its own private copy of
the variable with the master copy in memory.
It can be apply only to instance variables.

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why synchronization is important?

591


What are different data types?

577


can used Protected Class outside Function.?

616


What is the difference between overriding and overloading in OOPS.

567


What is the use of default method in interface in java? Explain

555






What is the byte order of byte buffer?

571


Can we declare an interface as final?

578


What is the difference between choice and list?

594


Can java cast null?

601


Give example to differentiate between call by value and call by reference.

597


What type of value does sizeof return?

543


What is identifier give example?

561


Can we clone singleton class in java?

519


What is the difference between class forname and new?

552


What is bufferedreader in java?

584