2 Comments
User's avatar
⭠ Return to thread
Twinkle Gupta's avatar

How Bill pugh is singleton, everytime the helper classes will be loaded, then the instance will be created, right?

Expand full comment
Ashish Pratap Singh's avatar

the singleton instance is only created the first time helper class is loaded. Subsequent calls to getInstance() return the existing instance since it's declared as static.

Java guarantees that static fields are initialized only once, even in a multi-threaded environment.

Expand full comment