I have a question why I'm not getting output pls help me in threading concept | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

I have a question why I'm not getting output pls help me in threading concept

class musaif1 extends Thread{ //@Override public void one(){ while(true){ System.out.println("hello im doing home work"); } } } class musaif2 extends Thread{ //@override public void two(){ while(true){ System.out.println("hello im cooking food"); } } } public class musaif { public static void main(String[] args) { musaif1 m1 = new musaif1(); musaif2 m2 = new musaif2(); m1.start(); m2.start(); } }

9th Oct 2021, 10:39 PM
Musaif
2 Réponses
+ 2
class musaif1 extends Thread{ //@Override public void run(){ while(true){ System.out.println("hello im doing home work"); System.out.println("hello im doing home work and also reading ans"); } } } class musaif2 extends Thread{ //@override public void run(){ while(true){ System.out.println("hello im cooking food"); System.out.println("hello im cooking food and also watching tv"); } } } public class musaif { public static void main(String[] args) { musaif1 m1 = new musaif1(); musaif2 m2 = new musaif2(); m1.start(); m2.start(); } } I got the answer Thank you guys
9th Oct 2021, 11:14 PM
Musaif
9th Oct 2021, 11:21 PM
Stefanoo
Stefanoo - avatar