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


Please Help Members By Posting Answers For Below Questions

Why java strings are immutable in nature?

583


How do you define a parameter?

576


What does yield method of the thread class do?

574


'A class is a template for an object' explain this statement.

542


What are thread local variables?

544






What does the exclamation mark mean in java?

586


What is the difference between this() and super() in java?

531


What is assembly language?

546


What is jit compiler in java?

575


Why hashmap is used in java?

544


What is skeleton and stub? What is the purpose of those?

535


Can we inherit a class with private constructor?

564


what type of questions asked for barclays technologies pune please send urgent

5223


What is the difference between logical data independence and physical data independence?

527


What are the differences between Java 1.0 and Java 2.0?

1667