I went through the wiki https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom to understand Initialization on demand holder Idiom for Singleton pattern, though the wiki mentions how it's thread safe, it doesn't say how this actually ensures only one instance is created ever, i.e if in two different classes Something.getInstance()
is called how do they have the same object ?
I am new to Java, so any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire