Home > DeveloperSection > Interviews > Can Java object be locked down for exclusive use by a given thread?

Posted on    May-07-2015 11:54 PM

 Java Java  Threading 
 1 Answer(s)
  713  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Posted on    May-07-2015 11:54 PM

Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.

Don't want to miss updates? Please click the below button!

Follow MindStick