what is private constructor?what are the uses of writing
private constructor in our program?

Answer Posted / sirisha

a constructor which is declared with private accesspecifer,
we can call it is private constructor,so that we can nt
create object from out side of the class, in this way we
can provide security to our class

Is This Answer Correct ?    39 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to display all the prime numbers between 1 and 100

719


What are the types of inner classes (non-static nested class) used in java?

807


Explain about sets?

768


Can a class be declared as static?

891


What is equlas() and hashcode() contract in java? Where does it used?

821


Why is static used?

768


What are the advantages of user defined functions?

755


Discuss 2D arrays.

812


What is the benefit of singleton pattern?

746


Why do we create threads in java?

809


Difference between error and exception

5470


What are thread groups?

760


What is a function argument in java?

771


Explain spliterator in java8?

796


What is an example of a boolean?

801