Dear Ranchers,
and the following instantiations:
Object obj1 = new Object();
Object obj2 = new Object();
obj1 and obj2 are accessible to two different threads and the threads are about to call the getLocks() method.
Assume the first
thread calls the method getLocks(obj1, obj2).
Which of the following is true?
________________________________________________________________
a The second thread should call getLocks(obj2, obj1)
b The second thread should call getLocks(obj1, obj2)
c The second thread should call getLocks() only after first thread exits out of it.
d.The second thread may call getLocks() any time and passing parameters in any order.It should not call getLocks(obj2, obj1) because it may result in a deadlock.
e None of the above
Option B is correct Is Anyone Having a explanation to this??
Thanks,
With Regds,
Anand