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 ?    240 Yes 44 No






Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to implement a multithreaded applet?

1324


Can we call virtual funciton in a constructor ?

964


which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com

2289


Why does java not allow multiple public classes in a java file ?

1911


Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.

1359






What are the differences between Java 1.0 and Java 2.0?

843


How do you sing an Applet ?

1063


Can you give names of Container classes?

1058


How listener identify that the event came from a particular object?

677


how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT

891


placement papaers of spring computing technology

178


how to run ecllipse with jettyserver for windows environment using batch file

730


Name the components that are termed to be Heavy-weight component but available in Light-weight components?

1237


what type of questions asked for barclays technologies pune please send urgent

4241


Where can i get Latest SUN Certification Dumps and what are the Sun Certification Codes that are available, Im new to JAVA, so please gimme info as i need to write J2EE - Core Java Certification

594