How we create multiple Threads ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How we create multiple Threads ?

by extending myThread class by Thread and creating Two threads like this ==> class ThreadDemo { public static void main (string[] args) { myThread t1 = new myThread(); myThread t2 = new myThread(); t1.start(); t2.start(); }} the above implementation is creating Two threads or i am just creating an instance of same thread???????????????

7th Mar 2018, 4:37 PM
Abhijeet S. Sonawane
Abhijeet S. Sonawane - avatar
1 Answer
0
how can you say , it may be an instance of same thread. As i know once the execution of the thread is done it goes in dead state. So, the instance should not work for this
12th Mar 2018, 4:50 AM
Abhijeet S. Sonawane
Abhijeet S. Sonawane - avatar