This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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.