Ans
Volatile
is the modifier applicable only for variables &we can’t apply or class
& methods. If the value of the variable keep on change such type of
variable we have declare with volatile modifier. If declare as volatile for
every thread a separate local copy will be created. Once the value get
finalized just before terminating the thread the master copy value will be
updated with local stable value.
The
main disadvantage of volatile keyword is creating and maintaining a separate copy
for every method.
Volatile
variable means it’s value keep on change, but final value can’t change the
value, combination of volatile & final is illegal for all variables.