bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java volatile Keyword

❮ Java Keywords

volatile

Definition and Usage

The volatile keyword is a modifier that ensures that an attribute's value is always the same when read from all threads.

Ordinarily the value of an attribute may be written into a thread's local cache and not updated in the main memory for some amount of time. In this case, other threads will see a different value for the attribute. The volatile keyword makes sure that threads always update the value of an attribute in main memory.

Related Pages

Read more about modifiers in our Java Modifiers Tutorial .

❮ Java Keywords

Previous

Java void Keyword

Next

Java while Keyword