Suggest an editImprove this articleRefine the answer for “How does a lazy Singleton differ from an eager one?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)The difference between a **lazy** and an **eager** Singleton is the moment the instance is created: the eager one is created immediately when the class is loaded, the lazy one only on the first call to `getInstance()`. **Key point:** an eager Singleton is simpler and thread-safe but can waste resources; a lazy one is more economical but needs extra synchronization to be thread-safe.Shown above the full answer for quick recall.Answer (EN)ImageThe difference between a **lazy** and an **eager** Singleton is the moment the instance gets created: ### Eager Initialization The instance is created **immediately when the class is loaded**, before the first access. ```java public class Singleton { private static final Singleton instance = new Singleton(); private Singleton() {} public static Singleton getInstance() { return instance; } } ``` **Pros:** simplicity, thread safety. **Cons:** the object is created even if it is never used (wasted resources). ### Lazy Initialization The instance is created **only on the first call** to `getInstance()`. ```java public class Singleton { private static Singleton instance; private Singleton() {} public static Singleton getInstance() { if (instance == null) instance = new Singleton(); return instance; } } ``` **Pros:** resources are spent only when needed. **Cons:** requires extra synchronization to be thread-safe. **Summary:** Eager Singleton is faster but may waste resources. Lazy Singleton is more economical but harder to implement safely in a multithreaded setting.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.