Difference between Process.run() and Process.start()

后端 未结 3 1238
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-18 23:44

I am struggling to understand the difference between run() and start(). According to the documentation, run() method invokes the calla

3条回答
  •  孤城傲影
    2021-01-19 00:27

    Invoking start() will create a new thread and execute run() in this new thread. Whereas, invoking run() yourself will execute it in the current thread itself. Execution of run() will not switch to a different thread. So it will execute its actions on the main thread itself.

提交回复
热议问题