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
What is used of static keyword in java?
What are the data types supported by java?
Are arrays primitive data types?
What is the difference between stringbuffer and stringbuilder class?
What is the difference between superclass and subclass?
How are destructors defined in java?
What are the 6 mandatory procedures for iso 9001?
What happens if an exception is not handled in a program?
What is the difference between state-based unit testing and interaction-based unit testing?
What does arrays sort do in java?
Does collectionutils isempty check for null?
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. (
Can a method be static?
What is local variable and instance variable?
Can inner class be public in java?