What is Transient and volatile

Answer Posted / sudhadevi

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 ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What purpose do the keywords final, finally, and finalize fulfill?

608


What is sorting algorithm in java?

517


When should I use stringbuffer?

564


Is minecraft java edition free?

572


What are the differences between graph and tree?

641






What is a get method?

528


What two classes are used to read data only?

634


What is a class component?

601


Is java call by reference?

525


What is stack explain?

497


Why does java have two ways to create child threads? Which way is better?

538


Write a code to show a static variable?

608


What is the final field modifier?

538


What is string buffer?

498


What is integer parseint?

542