How to create an instance of a class if the class has
private constructor?

Answer Posted / krishnanv

The above answer is perfectly ok only one thing missing i.e
the getObj() method must be static, then only we can call
directly without instantiating that class object.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many characters is 2 bytes?

526


Is special character in java?

607


What are the types of methods in java?

576


What are wrapper classes in java?

594


Can inner class have constructor?

545






What are the 4 types of research methods?

509


What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?

516


What do you understand by looping in java? Explain the different types of loops.

561


What is a war file?

544


What does a za z0 9 mean?

560


What is Enum in Java?

679


What does nextint () do in java?

552


State the significance of public, private, protected class?

649


Explain about map interface in java?

586


How do you use parseint in java?

509