Originally posted by rajesh mohareer: hi i am rajesh i am new to this forum.
i have a question
Can i know the usage of volatile keyword in the java?
Awaiting for your response
When a static or instance variable is declared as volatile, the compiler will generate code that... (1) will not cache or perform other optimization with it. Every usage will be a read from memory, and every assignment will immediately write to memory. And (2), every read and write will be assured as atomic. For most data types, reading and writing are normally atomic, so this will only affect the long and double types.