if our run() method is in the same class as our thread instance ....so.instead of writing something like Thread thread=new Thread(new myclass); ......would Thread thread =new Thread(this); suffice? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

if our run() method is in the same class as our thread instance ....so.instead of writing something like Thread thread=new Thread(new myclass); ......would Thread thread =new Thread(this); suffice?

2nd Jul 2016, 11:24 PM
Arsal Azam
Arsal Azam - avatar
2 Answers
+ 4
Yes, in that case, your class must implements the Runnable interface.
3rd Jul 2016, 10:57 AM
samuel delepoulle
samuel delepoulle - avatar
0
ohhhh thanks a lot bro
15th Jul 2016, 6:36 PM
Arsal Azam
Arsal Azam - avatar