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

后端 未结 7 1636
粉色の甜心
粉色の甜心 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:43

    Calling start() will create a new execution thread, and then the run() will be executed in the newly created thread

    where as directly calling run() will execute the code in the current thread

提交回复
热议问题