How can the wait() and notify() methods be called on Objects that are not threads?

前端 未结 9 1004
耶瑟儿~
耶瑟儿~ 2020-11-29 19:00

How can the wait() and notify() methods be called on Objects that are not Threads? That doesn\'t really make sense, does it?

Surely, it mus

9条回答
  •  广开言路
    2020-11-29 19:14

    "This method should only be called by a thread that is the owner of this object's monitor." So I think you must make sure there is a thread who is the monitor on the object.

提交回复
热议问题