The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search

Trail: Essential Java Classes
Lesson: Doing Two or More Tasks At Once: Threads

Volatile

You can declare that a member variable is modified If your class contains a member variable that is modified asynchronously by concurrently running threads, you can use Java's volatile keyword to notify the Java runtime system of this. At this time, the Java runtime system ignores the volatile marker. However, future releases of the Java runtime system will use this information to ensure that the variable is loaded from memory before each use, and stored to memory after each use to ensure that the value of the variable is consistent and coherent within each thread.

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search