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


Please Help Members By Posting Answers For Below Questions

How do you reverse sort a list in java?

700


Explain the advantages of packages in java?

687


What is adapter in java?

684


What is the use of pattern in java?

737


Is an array a vector?

719






Is treeset sorted in java?

746


What is variable and rules of variable?

725


What is tostring () method?

745


Can we create object of static class?

729


What is the difference in between cpp and java? Can u explain in detail?

811


What is proper subset?

739


What is an i/o filter?

1128


What is a wrapper method?

728


What is the size of string?

739


What does string intern() method do?

796