Volatile:
A class-member variable might be shared between multiple threads. So each
thread maintains its own working copy of this variable. now if the variable is not volatile, each thread will NOT reconcile its working copy with the master copy at object level. so just put volatile infront of all those variable which are shared among multiple threads. it will force all threads to reconcile their own copies of variable to master copy.
However volatile is not frequently used thing in
java. better way to use synchronization.