what is the use of private constructor in core java?

Answers were Sorted based on User's Feedback



what is the use of private constructor in core java?..

Answer / 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

what is the use of private constructor in core java?..

Answer / rajib

Whenever we r using singleton class then we use constructor
as private.

Is This Answer Correct ?    38 Yes 6 No

what is the use of private constructor in core java?..

Answer / deep chandra harbola

private constructor are used to create Sinleton class.
example logger class
for singleton class only one object can be created.
by default member of singleton class are static.
singleton class can not be inherited.

Is This Answer Correct ?    29 Yes 3 No

Post New Answer

More Core Java Interview Questions

What is a java object and java application?

0 Answers  


What is string length in java?

0 Answers  


Howmany classes that package java.applet.* contains?

1 Answers   TCS,


Is nullpointerexception checked or unchecked?

0 Answers  


Explain abstract class in java?

0 Answers  


What is the use of math abs in java?

0 Answers  


i need source code for income tax program using java inheritance

1 Answers  


How to create a base64 decoder in java8?

0 Answers  


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

0 Answers  


how many ways we can serialize the java object?

2 Answers   Satyam,


What is java autoboxing?

0 Answers  


How do you define a variable?

0 Answers  


Categories