Which Method is better to create thread and why??? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

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

11th Apr 2018, 8:17 AM
Pandurang vadane
Pandurang vadane - avatar
2 Respostas
+ 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