In this tutorial we will discuss about the volatile keyword in Java. When a field is declared as volatile, then, the Java Memory Model ensures that all threads will “see” the same consistent value. In Java, a global ordering is imposed on the read and write operations concerning a volatile variable. A thread that access […]