What is singleton class?

Answer Posted / akshat maheshwari

A singleton is an class that can be instantiated once, and
only once. This is a fairly unique property, but useful in a
wide range of object designs. Creating an implementation of
the singleton pattern is fairly straightforward - simple
block off access to all constructors, provide a static
method for getting an instance of the singleton, and prevent
cloning.

Is This Answer Correct ?    19 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is used of static keyword in java?

573


What are the data types supported by java?

535


Are arrays primitive data types?

625


What is the difference between stringbuffer and stringbuilder class?

554


What is the difference between superclass and subclass?

529






How are destructors defined in java?

556


What are the 6 mandatory procedures for iso 9001?

515


What happens if an exception is not handled in a program?

608


What is the difference between state-based unit testing and interaction-based unit testing?

484


What does arrays sort do in java?

527


Does collectionutils isempty check for null?

795


4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (

1399


Can a method be static?

513


What is local variable and instance variable?

595


Can inner class be public in java?

532