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

Does anyone still use java?

0 Answers  


What are the two ways to create a thread?

0 Answers  


How many types of parsers are there?

0 Answers  


Difference between arraylist and vector.

0 Answers  


how to use crystal reports in java

2 Answers  


in a console we r giving java <class name> if r pressing enter where it'll goes

2 Answers   CSC,


What is assembly language?

0 Answers  


Explain scope or life time of local variables in java?

0 Answers  


What are the 6 mandatory procedures for iso 9001?

0 Answers  


What is an immutable class? How to create an immutable class?

0 Answers  


What are the steps to do connection pooling in weblogic?

1 Answers   TCS,


How many JVMs can run on a single machine and what is the Just-In-Time(JIT) compiler?

0 Answers   Global Logic,


Categories