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 |
Is jdk required on each machine to run a java program?
What is arraylist e in java?
What are access specifiers in java ?
0 Answers Akamai Technologies,
What is the purpose of file class?
How would you convert bytes to string?
what is the logic inside any default constuctor?
What are the advantages of exception handling?
How can we make a class singleton?
Is static a singleton?
What is constructor chaining and how is it achieved in java?
What is Runtime class and its purpose?
What is a package in java? List down various advantages of packages.