How can we design/implement singleton object?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you explain singleton pattern?

566


Why have we declared the instance reference volatile?

537


What are the benefits of the proxy in the design pattern?

593


What non-visual coding tools are available for web design?

2117


When singleton pattern is used?

597






Why should we not use singleton pattern?

566


What is the difference between adapter and facade?

627


What is singleton design pattern in java?

591


What is the difference between proxy and adapter?

607


Where should we use singleton design pattern?

539


Why do we need singleton pattern?

583


What is the factory pattern in the design pattern?

738


Is singleton a design pattern?

595


Contact a small, medium, and a large contract program within your organization. Interview the Technical Director or Project Engineer to identify the following information: a. Request the individual to graphically depict their development strategy? b. What factors drove them to choose the implementation strategy? c. What were some of the lessons learned from developing and implementing the strategy that would influence their approach next time? d. How was the V & V strategy implemented?

2386


what is the lazy design pattern?

599