import java.io.*;
class A extends Thread
{ public void run()
{ System.out.println("Thread A started");
for(int i=5;i>0;i--)
{ System.out.println(i);
}
}
}
class B extends Thread
{ public void run()
{ System.out.println("Thread B started");
for(int i=5;i>0;i--)
{ System.out.println(i);
}
}
}
class C extends Thread
{ public void run()
{ System.out.println("Thread C started");
for(int i=5;i>0;i--)
{ System.out.println(i); }
}
}
class thread3
{ public static void main(String args[])
{ A thread_a=new A();
B thread_b=new B();
C thread_c=new C();
thread_c.setPriority(Thread.MAX_PRIORITY);
thread_b.setPriority(thread_a.MAX_PRIORITY);
thread_a.setPriority(Thread.MIN_PRIORITY);
System.out.println("Thread A");
thread_a.start();
System.out.println("Thread B");
thread_b.start();
System.out.println("Thread C");
thread_c.start();
System.out.println("End of Main Thread");
}
}
Comments
Post a Comment