What is volatile variable?

What is volatile variable?

Volatile means the storage is likely to change at anytime and be changed but something outside the control of the user program. This means that if you reference the variable, the program should always check the physical address (ie a mapped input fifo), and not use it in a cashed way. Variables declared to be volatile will not be optimized by the compiler because the compiler must assume that their values can change at any time. We use volatile keyword to declare the volatile variable.

Date:2015-01-09 00:00:00

Post Your Answers

User Email:

User Name:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher