Where and how can you use a private constructor?



Where and how can you use a private constructor?..

Answer / Aniket Shukla

A private constructor can be used within a class to prevent other classes from creating objects of that specific class. It ensures that the class acts as an abstract class. A private constructor cannot be accessed outside the class.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

what is the difference between HashMap and Hashtable

17 Answers   Value Labs, Virtusa,


What is meant by oops concept in java?

1 Answers  


What is anonymous inner class?

1 Answers  


What is flush () in java?

1 Answers  


Give differences between Quicksort &Mergesort. When should these sorts be used andwhat is their running time in java?

1 Answers   Genpact,


What is singletonlist in java?

1 Answers  


what is j2se

3 Answers  


Define how does a try statement determine which catch clause should be used to handle an exception?

1 Answers  


What do you mean Abstraction in java?

1 Answers   Aspire, Infogain,


why using interface interface ?

1 Answers  


What is a protected method?

1 Answers  


what is difference betwwen hashmap and hashtable ?

7 Answers   Fidelity,


Categories