
10 Interview questions on Singleton Pattern in Java - javabuddy
http://javarevisited.blogspot.com/2011/03/10-interview-questions-on-singleton.html?sms_ss=hackernews&at_xt=4d71fa08f9706504%2C0
======
prodigal_erik
If you really need a lazy Java singleton for some reason, letting the
classloader construct it (guaranteed to happen at most once, and as late as
possible) is effortless and more robust than screwing around with the
synchronization yourself. On the other hand, interviewing candidates has so
shaken my faith that I'd be very impressed to meet anyone who knew this.

[http://en.wikipedia.org/wiki/Singleton_pattern#The_solution_...](http://en.wikipedia.org/wiki/Singleton_pattern#The_solution_of_Bill_Pugh)

~~~
javabuddy
Agree, Singleton loaded by Classloader is most robust way of doing it but they
I just think why people discovered double check locking pattern for creating
singleton instance ?

------
personalcompute
Most of these are trivial or just generic threadsaftey questions.

You probably should not be using the singleton pattern in the first place
though, global state is not an elegant solution.

