In Bill Pugh implementation object will be created when getInstance() will be called for the first time.
In Eager initialization object will be create when class is loaded in jvm, but class will be loaded when it is first used i.e., when getInstance() is called.
The behavior looks similar here.
Aucun commentaire:
Enregistrer un commentaire