bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java volatile Keyword

Flash cards

Review the key moves

1/4
Core idea

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.

1Quick choice

Which statement best captures the main point of this lesson?

2Order

Put the learning moves in the order that makes the concept easiest to apply.

The volatile keyword is a modifier that ensures that an attribute's value is always the same when read from all threads.
Definition and Usage
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