I am recently asked about java related question in an interview with following code, since I am very new to java and barely code in Java so I really have no idea what the follow
The getInstance() method should be synchronized, otherwise many instances could be created if multiple threads calls getInstance() at the same time. So I would select option 1.