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 if static is removed from main method?

575


Does java trim remove newline?

542


What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?

626


What is the use of a conditional inclusion statement in Java ?

590


What is object in java?

536






What is hashtable and explain features of hashtable?

566


Do you know why doesn't the java library use a randomized version of quicksort?

554


Why do we use threads in java?

562


What is string data?

557


Is void a keyword in java?

598


What is the reflection?

563


Define how objects are stored in java?

565


How do you execute a thread in java?

505


What is the purpose of a parameter?

530


What is super keyword explain with example?

535