Quick Answer
Singleton ensures only one instance of a class exists. Implementation: private constructor, static getInstance() method. Thread-safe options: eager initialization (static final field), synchronized getInstance() (slow), double-checked locking with volatile (fast, correct in Java 5+), or the enum singleton (simplest and thread-safe by JVM guarantee). Use dependency injection instead of Singleton where possible.
Answer
Ensures one instance of a class exists. Implement using eager loading, lazy loading, double-checked locking, or enum. Provides global access to the instance.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.