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

What design pattern you have used in your project? I answered Factory pattern, how it is implemented? What are its advantage? Do know about Abstract Factory?

1082


how to handle exceptions in ejb?

1111


How to solve the problem of generating the unique hash keys with hash function?

693


Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..

1090


1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE VARIABLE" HERE?

2282






when to use ArrayList and when to use HashMap in webApplication.

2633


what are the disadvantages of indexes in oracle?

1024


v-model life cycle

737


I want to store more than 10 objects in a remote server? Which methodology will follow?

1758


What is procedure overloading?

955


What is the java project architecture?

1022


23. Storage space in java is of the form Stack Queue Heap List 24. What is java code embedded in a web page known as Applets Servlets scriptlets snippets 25. Which of the following attributes are compulsory with an tag?. code,height & width. 26. What does 'CODEBASE' in an applet tag specify?. Files absolute path.

1281


how to deploy apache tomcat server to weblogic server in java

892


How to display names of all components in a Container?

1707


Java openings 3 - 5 years, Lnt Infotech. requirements - core java, J2ee, struts, hibernate Interview Date:- 19 March 2011 Time:- 9:00 AM to 12:00 Pm Interview Location - L & T Infotech, Manapakkam, Chennai Refererral PS NO:- 291649 (Please mention this when u fill the form only then u will be considered for interview) Documents Required:- Latest Resume, Photograph and last 3 payslips Mail me on vasan2211@gmail.com once u appear for interview

1985