Back
Can anyone help me how I can able to implement a singleton pattern using Java?
In simple terms, we can use enum class for a singleton pattern in Java:
public enum Demo { INSTANCE;}
public enum Demo {
INSTANCE;
}
I hope this will help.
Want to become a Java expert? join Java Training now!!
31k questions
32.8k answers
501 comments
693 users