title: Lazy initialization Singleton class with volatile variable
body: <p>I came across a singleton class {lazy initialization}. The code is as below</p>
  
  <pre><code>// Singleton reference for this class
      private static volatile FileProperties INSTANCE = null; 
  
      public static FileProperties getInstance() {
              if (INSTANCE == null) {
                  synchronized (FileProperties.class) {
                      if (INSTANCE == null) {
                          INSTANCE = new FileProperties();
                      }
                  }
              }
              return INSTANCE;
          }
  </code></pre>
  
  <p>My question is what is the benefit we are getting by making <strong>INSTANCE as volatile</strong>
  Since we already taking care of thread safety by synchronized.
  Is there any benefit of volatile in this scenario ?</p>