The methods wait(...)
, notify()
and notifyAll()
are available on a Thread
instance, but only
because all classes in Java extend Object
and therefore automatically inherit those methods. But there are two very good reasons for not
calling them on a Thread
:
BLOCKED
, WAITING
, ...), so calling
them will corrupt the behavior of the JVM. Thread myThread = new Thread(new RunnableJob()); ... myThread.wait(2000);