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

What is the difference between variable declaration and variable initialization?

0 Answers  


What data type is a string?

0 Answers  


Will the jvm load the package twice at runtime?

0 Answers  


What is the difference between static and global variables and also define what are volatile variables?

0 Answers   Flextronics, Hexaware,


How do you compare arrays in java?

0 Answers  


What is meant by tab pans?

0 Answers  


What is prime number in java?

0 Answers  


Convert a binary search tree to a sorted doubly linked list inplace.

1 Answers   Amazon,


explain the clone method and clonable interface

1 Answers  


What is a singleton factory?

0 Answers  


How do you ensure that n threads can access n resources without deadlock?

0 Answers  


can rmi and corba based applications interact ?

0 Answers  


Categories