1/* Volatile variable means that the variable will be directly read from
2and written to the computer's main memory and not to the CPU cache.
3
4In Java it is done using the volatile keyword.
5
6This is used in multithreaded applications. In multithreaded environment
7where each thread may copy the variable into caches of different cores.
8Thus making the data available to other threads inconsistent.
9*/
10
11public class SharedObject
12{
13 public volatile int counter = 0;
14}