Organizational Research By

Surprising Reserch Topic

What happens when wait() is called on an object not extending Thread or implements Runnable?


What happens when wait() is called on an object not extending Thread or implements Runnable?


asked Apr 29, 2015 in Core java by rahulgii
0 votes
28 views



Related Hot Questions

1 Answer

0 votes
The java docs are pretty clear on this. It does as the names suggest, causes the current thread to wait until notify or notifyall is called on the object (by another thread). These methods are used to coordinate between Threads that need access to the same critical resources and need mutual exclusion. In depth discussion here.

Calling wait and notify on a Thread object only makes sense if that Thread is being used as the lock object, which would be unusual in my experience.
answered Apr 29, 2015 by rahulgii

...