What is singleton class?
Answer Posted / sathya
Singleton class:
This is a class which can be instatiated only once.
Eg:
Public class Singleton
{
private static single = new Singleton();
Private Singleton();
{}
}
For a singleton class, the constructor is made private and
a static variable is used for instatiating the class.
Is This Answer Correct ? | 242 Yes | 44 No |
Post New Answer View All Answers
Why is the main method declared static?
Can we instantiate interface in java?
What is difference between arraylist and list in java?
What do you mean by ternary operator in java?
Is array primitive data type in java?
Is java call by reference?
Do I need java on my computer?
What is the difference between class & object?
When the constructor of a class is invoked?
Why is string builder not thread safe?
What does the string method compareto () do?
Can a hashset contain duplicates java?
what is the major difference between linkedlist and arraylist in java?
What is array class in java?
What are recursive functions?