Wednesday, February 25, 2009

sourcecode to demonstrate thread priority



package thread;

class MyThre extends Thread
{
public void run()
{
for(int i=0; i<=2 ;i++)
System.out.println("child thread");
}

}
public class ThreadD
{
public static void main(String a[])
{
Thread.currentThread().setPriority(10);
System.out.println(Thread.currentThread().getPriority());
MyThre t= new MyThre();
System.out.println(t.getPriority()); //10 10

}
}


0 comments:

Post a Comment