import java.util.*;
class frist extends Thread
{
public void run()
{
System.out.println(" frist thread stated");
for (int i=0;i<10 ;i++ )
{
System.out.println(i);
}
System.out.println("frist thread ended");
}
};
class secound extends Thread
{
public void run()
{
System.out.println("Secound thread ");
for (int i=0;i<10 ;i++ )
{
System.out.println(i);
}
System.out.println("Secound thread ended");
}
};
class threed extends Thread
{
public void run()
{
System.out.println("3th thread");
for (int i=0;i<10 ;i++ )
{
System.out.println(i);
}
System.out.println("3th thread ended");
}
};
class Test
{
public static void main(String[] durga)
{
frist thread1=new frist();
secound thread2=new secound();
threed thread3=new threed();
thread1.setPriority(Thread.MAX_PRIORITY);
thread2.setPriority(Thread.MIN_PRIORITY);
thread3.setPriority(thread2.getPriority()+1);
System.out.println("frist Thread");
thread1.start();
System.out.println("secound Thread");
thread2.start();
System.out.println("3th Thread");
thread3.start();
}
};
Our website is made possible by displaying ads to our visitors.
Please help us continue to provide you with free. So please disabling your ad blocker.