Question from the Java and Craftsmanship test

Write a thread safe singleton in Java

Hard

Given this code

public class Singleton {

  public static Singleton getInstance() {
    return SingletonHolder.instance;
  }

  private static class SingletonHolder {
    private static final Singleton instance = new Singleton();
  }
}

What assertions are true?

Author: Clément DevosStatus: PublishedQuestion passed 287 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!