Why wait ,notify and notifyAll Methods are in Object Class?

前端 未结 4 1649
野性不改
野性不改 2020-12-21 07:15

i know that wait() method always written in synchronized method/block and make lock on Object but i want to only know that what problem is arise at that time when this all m

4条回答
  •  -上瘾入骨i
    2020-12-21 07:52

    The problem with using them on a Thread object is that the Thread uses this lock for it own purposes. This is likely to lead to confusion and odd bugs.

提交回复
热议问题