How to prevent to create multiple objects of a java class?

Answer Posted / naseer

declare constructor as private .that class only create one object

Is This Answer Correct ?    10 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between path and classpath variables?

563


How will you print number in reverse (descending) order in BST.

576


What are inner classes or non static nested classes in java?

705


What are internal and external variables?

542


What is a function in java?

566






What is a blocking method in Java?

601


Why hashcode is used in java?

497


How is treeset implemented in java?

488


Does substring create a new object?

526


What is the syntax and characteristics of a lambda expression? Explain

537


Explain about serializable interface in java?

578


What is super constructor?

546


What is a parameter used for?

512


What are the major advantages of internal iteration over external iteration?

570


How many return statement are allowed in a function?

453