We have start(), run() and join() methods
with threads as we use them on thread objects, these methods are under Thread class
.
And wait(), notify(), and notifyAll()
which we use also with Thread object but these methods are under Object class
.
I Am thinking why there is need to define these methods under Object class as we call them only with Threads
?. We know whenever we call wait()
object goes to the wait state waiting for a Shared resource/a condition to satisfy but this can only happen in threaded environment.
So the question is why there is need to put these methods under Object class?
Let me know if I am missing anything here.