Running Thread by calling start() and run(), what is the difference?

后端 未结 7 1633
粉色の甜心
粉色の甜心 2020-12-07 04:00

It may be a basic question, i was confused with this,

in one file i have like this :

public class MyThread extends Thread {
    @Override
    public          


        
相关标签:
7条回答
  • 2020-12-07 04:59

    Calling start starts the thread. It does the underlying work to create and launch the new thread, and then calls run on that new thread.

    Calling run just calls the run method, on the current thread. You never call run directly, use start.

    0 讨论(0)
提交回复
热议问题