Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Is dependency injection a design pattern?

950


Why singleton beans are not thread safe?

1023


What is the prototype design pattern?

1032


Shall we use abstract classes or interfaces in policy / strategy design pattern?

1038


What are the most important software design patterns?

1108


Is bean a singleton?

928


Write the code for a singleton class?

1004


Explain what is good design?

1024


What is clean architecture?

955


Are singletons bad?

989


What are structural design patterns?

1092


Using any system, product, or service your organization provides, identify the human system roles for the product.

2528


What is the builder pattern?

1037


Why do we need singleton pattern?

962


What is the design pattern?

1021