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

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

    the simple answer to your question is this:

    run(): runs the code in the run() method, blocking until it's complete

    start(): returns immediately (without blocking) and another thread runs the code in the run() method

提交回复
热议问题