How can we design/implement singleton object?
Answers were Sorted based on User's Feedback
Answer / ravi
Make the constructor private
provide a static synchronized method to get the Instance.
this should make the object singleton for that jvm instance
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / jayashri
by declaring the constructor as private and we have to create public static method which returns the address of single object.
Is This Answer Correct ? | 0 Yes | 0 No |
Is dependency injection a design pattern?
Give me example of chain of responsibility design pattern?
What is the publish/subscribe model?
What are sequence diagrams, collaboration diagrams and difference between them ?
8 Answers ACET, CT, CTS, Infosys,
Can we have this pattern implemented using static class?
What is design pattern ?
Why do we need singleton pattern?
What is the behavioral design pattern?
What is software 'quality'?
write 5 best test cases like any password?password should be mixed case with atlest one number or special characters?
Why have we used synchronized here?
When to Use a Factory Pattern?