0

Thread

What is the difference between thread.start(); and thread.run(); ?

28th Feb 2019, 2:46 AM
Aamir Naseer
Aamir Naseer - avatar
2 Réponses
+ 3
If you call thread.start(), a new thread instance is created and the internal Runnable's run() method is invoked. If you call thread.run(), the internal Runnable just executes on the existing thread. In order to multithread, you will want to start new threads and exeucte Runnables separately, instead of running them all on the same thread.
28th Feb 2019, 3:03 AM
Fermi
Fermi - avatar
0
what are the threads ?
28th Feb 2019, 3:13 AM
Aamir Naseer
Aamir Naseer - avatar