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 an object in java?

756


What classes of exceptions may be thrown by a throw statement?

729


Can java object be locked down for exclusive use by a given thread?

763


Why static functions are used?

782


What is an infinite loop?

764


Which one of the following suits the description of a string better: derived or primitive?

709


What is navigable map in java?

723


What are the basics of core java?

738


Explain the different forms of polymorphism?

761


What is lambda expression in java?

709


What is the difference between final, finally and finalize()?

764


What does this () mean in constructor chaining concept?

805


what do you mean by classloader?

733


Can static methods access instance variables in java?

772


What is the equal sign?

788