Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Can we synchronized a constructor? Give the reason for your answer.

user-image
Question ajoutée par Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
Date de publication: 2013/08/31
George El Haddad
par George El Haddad , Software Engineer (Freelance) , Scientific Software Consultancy & Training

Check this detailed answer on stackoverflow about synchronizing a constructor. It is not allowed by the Java language specification but they show examples on how you can kind of do it via a small hack. It seems dangerous, but it can still be done.

Check it out here http://stackoverflow.com/questions/4880168/why-cant-java-constructors-be-synchronized

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?