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

Is jdk required on each machine to run a java program?

0 Answers  


What is arraylist e in java?

0 Answers  


What are access specifiers in java ?

0 Answers   Akamai Technologies,


What is the purpose of file class?

0 Answers  


How would you convert bytes to string?

0 Answers  






what is the logic inside any default constuctor?

2 Answers  


What are the advantages of exception handling?

0 Answers  


How can we make a class singleton?

0 Answers  


Is static a singleton?

0 Answers  


What is constructor chaining and how is it achieved in java?

0 Answers  


What is Runtime class and its purpose?

2 Answers  


What is a package in java? List down various advantages of packages.

0 Answers  


Categories