title: Is IntelliJ's java singleton thread-safe
body: <p>IntelliJ can autogenerate a template for a singleton class, which looks something like this:</p>
  
  <pre><code>public class A {
      private static A ourInstance = new A();
  
      public static A getInstance() {
          return ourInstance;
      }
  
      private A() {
      }
  }
  </code></pre>
  
  <p>Is this implementation of singleton thread-safe? I have read about implementing thread-safe singletons through enums. I was wondering if the above implementation is thread-safe as well. As 'ourInstance' has been defined as static and initialized as a class variable, there should be just one copy of the object.</p>