class One extends Thread
{
public void run()
{
for(int m=1;m<=5;m++)
{
for(int k=10;k<=15;k++)
System.out.println(Thread.currentThread().getName()+" k "+k);
Thread.yield();
}
}
}
class Two extends Thread
{
public void run()
{
for(int z=10;z<=15;z++)
{
System.out.println(Thread.currentThread().getName()+" z "+z);
}
}
}
class Yld
{
public static void main(String args[]) throws InterruptedException
{
One obj=new One();
Two temp=new Two();
Thread t1=new Thread(obj,"First");
Thread t2=new Thread(temp,"Second");
t1.start();
t2.start();
for(int p=5;p<=15;p++)
System.out.println(Thread.currentThread().getName()+"india"+p);
}
}
{
public void run()
{
for(int m=1;m<=5;m++)
{
for(int k=10;k<=15;k++)
System.out.println(Thread.currentThread().getName()+" k "+k);
Thread.yield();
}
}
}
class Two extends Thread
{
public void run()
{
for(int z=10;z<=15;z++)
{
System.out.println(Thread.currentThread().getName()+" z "+z);
}
}
}
class Yld
{
public static void main(String args[]) throws InterruptedException
{
One obj=new One();
Two temp=new Two();
Thread t1=new Thread(obj,"First");
Thread t2=new Thread(temp,"Second");
t1.start();
t2.start();
for(int p=5;p<=15;p++)
System.out.println(Thread.currentThread().getName()+"india"+p);
}
}