+ 9
Why wait and notify is declared in Object class instead of Thread ?
3 Respostas
+ 11
Wait and notify is not just normal methods or synchronization utility, more than that they are communication mechanism between two threads in Java. And Object class is correct place to make them available for every object if this mechanism is not available via any java keyword like synchronized. Remember synchronized and wait notify are two different area and don’t confuse that they are same or related. Synchronized is to provide mutual exclusion and ensuringthread safety of Java class like race condition while wait and notify are communication mechanism between two thread.
+ 10
congratulations Zach for level up ....😀. keep it up ...👍
+ 8
thanks