Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
Why wait and notify is declared in Object class instead of Thread?
One Of the Toughest Questions asked in java.
1 Antwort
+ 3
As every object in java has only one lock(monitor) and wait (), notify (),notifyAll() are used for monitor sharing thats why they are part of Object class rather than Thread class . These methods works on the locks and locks are associated with Object and not
Threads .