What is singleton class?
-
that can not be inherited
-
that can be inherited only once
-
that can have only one object
-
there is no such class
A singleton class is a design pattern that restricts instantiation of a class to one object. This is achieved by making the constructor private, declaring a static instance variable, and providing a static public method (usually getInstance()) that returns the instance. Option C correctly states that a singleton can have only one object. Options A and B describe inheritance restrictions, which are not the definition of singleton.
A singleton class is a design pattern where the class is written so that only one instance of it can ever exist in the application, typically enforced with a private constructor and a static accessor method that returns the same shared instance every time.