JQ+Question ID :954959231469 Which of the following correctly tells about the effect of calling wait() method on an object? (Assume that the calling Thread has the lock of that object.) 1. The thread that has called wait stops executing until somebody else notifies it. 2. the object issuing a call to wait() halts until another object sends notify() or notifyall(). Correct answer is 1. I feel, even 2 is correct as the meaning of the statement is same as first. Or else i am interpreting in a different way??? pl, explain the second option. TIA Rashmi
Joined: Nov 04, 2001
hi Rashmi, if i'd have been there i 'd go with 1 as in second it says, "object that issues wait()...". this part is not clear with me as i interpret this as "object having a call to wait()...". now, in that case object having a call to wait() doesn't get blocked. the thread calling that method of that shared object gets locked or goes to waiting state... second reason for 2nd statement being false is, "another" object can't notify in anyway the object having wait(). ONLY THE OBJECT THAT IS LOCKED CAN SEND notify TO WAITING THREADS... i guess my second reasoning is much logical/valid than the first one. regards maulin.
Thanx a lot Maulin for the nice reasoning i found that some of the questions in JQ+ are poorly worded. So its really hard to interprete the meaning out of them. Even if u r clear with the concept , these type of wording can confuse u. Anyway, thanx Rashmi