Which Method is better to create thread and why??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Which Method is better to create thread and why???

11th Apr 2018, 8:17 AM
Pandurang vadane
Pandurang vadane - avatar
2 Answers
+ 8
The first way is to extend the Thread class, override the run() method with the code you want to execute, then create a new object from your class and call start(). The second method is to pass an implementation of the Runnable interface to the constructor of Thread, then call start().
11th Apr 2018, 8:31 AM
GAWEN STEASY
GAWEN STEASY - avatar
0
from both method which 1 Better ? why?
11th Apr 2018, 8:47 AM
Pandurang vadane
Pandurang vadane - avatar