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
Interviewer basically wants to check your knoweldge of Singleton pattern . Can the pattern be broken?. Ans is Yes. Check this or google - when singleton is not a singleton.
Best course is to use Enum based Singleton as suggested by Joshua Bloch