A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Difference between t. start and t.run()

  • In the case of t.start() a new thread will be created which is responsible for the execution of run () method.
  • But, in the case of t.run() a new thread will not created and run() will be executed just like a normal method called by main method.
  • Hence, in the previous program if we replace t.start() with t.run() then out is as follow:
  • Child thread is running(10 times)
  • Main thread is running(10 times)
  • This total output produced by only main thread.