Volatile provides a weak synchronization mechanism to ensure that variable updates are notified to other threads. Volatile variables are not cached in registers or invisible to other processors, so the most recent write value is always returned when reading a volatile variable. You can imagine the following semantics, but volatile is a more lightweight synchronization mechanism.volatile can only ensure visibility, but it does not guarantee atomicity. In other words, it cannot be used in composite operationsvolatile variables, such as i++.
public   void ( >int
this.value = value;
}
public synchronized int getValue(){
return value;
}
Volatile variables can be used when all of the following conditions are true
The write operation on a variable does not depend on the current value of the variable, or you can ensure that only a single thread updates the value of the variable.
The variable does not incorporate the invariant condition with other state variables
The access variable is not required to lock
From for notes (Wiz)
Volatile variables for Java concurrency programming