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
Explain the difference between abstraction and encapsulation.
How can you set an applet’s height and width as a percentage?
Does java vector allow null?
What is final access modifier in java?
How are observer and observable used in java programming?
Why is sizeof not a function?
What are local variables?
When do we use hashset over treeset?
How many types of constructors are used in java?
What is difference between array and vector?
Why scanner is used in java?
What does n mean?
Is it possible to override the main method?
What is the purpose of an interface?
What is the best definition for data?