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 |
How many types of interfaces are there?
Can we extend singleton class in java?
What is the default execution method in java?
what is class.forname() and how it will be useful ?
Write a function to find out longest palindrome in a given string?
Explain a situation where finally block will not be executed?
Is java based on c?
Is java a prime method?
What are the advantages of defining packages in java?
What is the difference between the >> and >>> operators?
Is java a digit method?
How is final different from finally and finalize?