what is the use of private constructor in core java?
Answer Posted / rakesh
Private constructor can be used if we do not want any other
class to instantiate the class. This concept is generally
used in Singleton Design Pattern. The instantiation of such
classes is done from a static public method.
| Is This Answer Correct ? | 54 Yes | 3 No |
Post New Answer View All Answers
I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?
Can we call virtual funciton in a constructor ?
Mention the default values of all the elements of an array defined as an instance variable.
Which is a valid identifier?
What is a cup of java?
Can we have more than one package statement in source file ?
What is byte code and why is it important to java’s use for internet programming?
What class allows you to read objects directly from a stream?
Can you inherit a constructor java?
What is lexicographically smallest string?
What is a conditional statement explain with example?
how to create constants in java?
What is final int?
What is java thread dump, how can we get java thread dump of a program?
What do you understand by the bean persistent property?