What is singleton class?

Answer Posted / nagarjuna

Singletonclass is a class which can be instantiated only once.
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 ?    4 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to use string tokenizer class.

812


Is hashset ordered?

736


What is the escape character in java?

696


What is a method in coding?

773


how we can use debug in myeclipse 6.0 in order solve the problems that exist in our program when there are 900 to 1000 pages in a web application

1850


What is the collection interface?

759


What are the types of java?

767


What is arguments in java?

699


Explain about the interpreter in java?

811


How will you communicate between two applets?

828


Why does java does not support multiple inheritance? Explain

715


Why java is platform independent? Explain.

764


How do you sort in ascending order in java?

656


How will you load a specific locale?

700


Is there a sort function in java?

745