Volatile explained with Singleton example

"Volatile keyword in Java is used as an indicator to Java compiler and Thread that do not cache value of this variable and always read it from main memory ...
A volatile variable can be used as an alternative way of achieving synchronization in Java in some cases, like Visibility. with volatile variable, it's guaranteed that all reader thread will see updated value of the volatile variable once write operation completed, without volatile keyword different reader thread may see different values ..."

Moreo on Violate keyword & how to use it here: https://javarevisited.blogspot.com/2011/06/volatile-keyword-java-example-tutorial.html