Hello Ranchers,
I have found the following ques in one of the mock exams.
Correct answer to this is A & D. I'm convinced about D but I have doubts about A. Can anyone clarify this option with example. Thanks.
Which of the following statements are true?
Select all valid answers.
A. A
thread can reacquire the lock on the same object when it already owns the lock.
B. The performance of synchronized methods is better than non-synchronized methods.
C. The notify() method is called on the thread executing the code.
D. A thread can have locks on different objects at the same given time.
E. The notifyAll() method is called on the threads waiting for the lock of an object or a class.