what is private constructor?what are the uses of writing
private constructor in our program?
Answer Posted / christian
a common use for a private constructor is to implement the
singletton pattern, which uses a public member variable of
the same type of the class which is defined. A public
getInstance() method uses this private constructor
Is This Answer Correct ? | 13 Yes | 6 No |
Post New Answer View All Answers
Why is string class considered immutable?
Explain the difference between protected and default access.
How garbage collection is done in java?
What is string data type?
What is the final variable?
What will be the output of round(3.7) and ceil(3.7)?
There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?
Is 0 a prime number?
What is the major drawback of internal iteration over external iteration?
How many bytes is a string?
How is it possible for two string objects with identical values not to be equal under the == operator?
What are the elements of java?
What is reverse function?
What is object of class in java?
What is maximum size of arraylist in java?