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

Answers were Sorted based on User's Feedback



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

Answer / sadiq

Using Singleton Design pattern we can prevent class creating
multiple objects.

Is This Answer Correct ?    30 Yes 3 No

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

Answer / naseer

declare constructor as private .that class only create one object

Is This Answer Correct ?    10 Yes 6 No

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

Answer / zoozoo

use collections

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Core Java Interview Questions

How many types of interfaces are there?

0 Answers  


Can we extend singleton class in java?

0 Answers  


What is the default execution method in java?

0 Answers  


what is class.forname() and how it will be useful ?

3 Answers  


Write a function to find out longest palindrome in a given string?

0 Answers  






Explain a situation where finally block will not be executed?

0 Answers  


Is java based on c?

0 Answers  


Is java a prime method?

0 Answers  


What are the advantages of defining packages in java?

0 Answers  


What is the difference between the >> and >>> operators?

1 Answers  


Is java a digit method?

0 Answers  


How is final different from finally and finalize?

0 Answers  


Categories