How to prevent to create multiple objects of a java class?
Answers were Sorted based on User's Feedback
Answer / sadiq
Using Singleton Design pattern we can prevent class creating
multiple objects.
| Is This Answer Correct ? | 30 Yes | 3 No |
Answer / naseer
declare constructor as private .that class only create one object
| Is This Answer Correct ? | 10 Yes | 6 No |
why not override thread to make a runnable? : Java thread
What if constructor is protected in java?
Explain how can you debug the Java code?
how a marker interface gets its functionality and when we implements a marker interface how it got invoked
What is the difference between method overriding and overloading?
What is binary search in java?
what modifiers are used with top-level class?
How to reduce flicking in animation?
How to sort an array from smallest to largest java?
how can we synchronize Hash map?
What is an enumeration?
Why is a constant variable important?