Volatile Variable

A field whose reads and writes have special cross-thread visibility guarantees.

What is Volatile Variable in Java?

Volatile Variable — A field whose reads and writes have special cross-thread visibility guarantees.

class Worker {
    volatile boolean running = true;
}

Level: Master · More Java terms at this level

Updated