2
Reply

what is a private constructor for a class ? what is its need ?

    When a class is containing all the members static, we no need of creating an object of that class. We can directly access members using dot(.) operator with that class. So, to prevent the class being created an object, we use private constructor.

    When a class is containing all the members static, we no need of creating an object of that class. We can directly access members using dot(.) operator with that class. So, to prevent the class being created an object, we use private constructor.