Flash cards
Review the key moves
What is the main idea behind Java volatile Keyword?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
Which statement best captures the main point of this lesson?
Put the learning moves in the order that makes the concept easiest to apply.
❮ Java Keywords
volatileDefinition 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