Interview Questions

Can you find whether thread holds lock on object or not?

Java Interview Questions and Answers (part 4)


(Continued from previous question...)

55. Can you find whether thread holds lock on object or not?

holdsLock(object) method can be used to find out whether current thread holds the lock on monitor of specified object.

holdsLock(object) method returns true if the current thread holds the lock on monitor of specified object.

(Continued on next question...)

Other Interview Questions