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

If we don’t want some of the fields not to serialize how to do that?

569


What kind of variables can a class consist?

595


Explain restrictions for using anonymous inner classes?

589


Can you declare an interface method static?

588


Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.

2378






How do generics work in java?

524


Can a static class have a constructor java?

554


What is volatile keyword in java

655


What is a top level class in java?

538


Explain java coding standards for methods?

614


What is module with example?

516


What is the function of log?

549


What is the basic concepts of OOPS?

695


What is covariant return type?

647


Why is it called buffering?

585