Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Can we call one synchronized method in another synchronized method with in the same class in java? if yes then how it will work ?

user-image
Question added by Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
Date Posted: 2013/12/04
Usman Azhar
by Usman Azhar , Technical Lead , wipro technolies ltd.

Yes, you can use it , Java uses concept of re-entrant lock, once your thread gets a lock holder object, it need not wait for the lock again, and can execute the synchronized method within a synchronized method. 

 

Yes , we can call any number of synchronized method within any synchronized method , it will work as stack how normal method works because when we make any method as synchnonized then lock is over class and thread which owns this lock is running all these methods so there is mens of conflict..

hope u get the answer.

More Questions Like This