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(); } }
2 Answers
+ 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