For Java, “volatile” tells the compiler that the value of a variable must never be cached as its value may change outside of the scope of the program itself.