Java创建线程对象后,直接调用其start()方法和run()的区别

答案

  • 调用 start()方法是启动新的线程,新的线程运行后,会在新线程上执行 run() 方法内的代码
  • 而直接调用 run() 方法只能在当前线程运行 run() 方法内的代码,并不会启动新的线程

results matching ""

    No results matching ""