Why we call Thread.start() method which in turns calls run method?

后端 未结 12 1116
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 01:40

Why do we call the thread object\'s start() method which in turns calls run() method, why not we directly call run() method?

12条回答
  •  無奈伤痛
    2020-11-29 02:39

    start() and run() methods are used for running a thread.The run() method is just an ordinary method, it is overridden by the user and it will be called on the current thread. The start() method runs the run() method indirectly and creates a new thread.

提交回复
热议问题