How to deal with multiple threads in one class?

后端 未结 6 1263
醉酒成梦
醉酒成梦 2021-02-04 12:31

Threads are often designed in two ways (see java tutorials): either by extending the Thread class or by implementing the Runnable class. Either way, you need to specify what wil

6条回答
  •  一向
    一向 (楼主)
    2021-02-04 13:04

    For each class create an anonymous class based on Runnable. This will allow you to do what you need to do inside the run() method.

提交回复
热议问题