Program to set thread priority

class A extends Thread
{
public void run()
{
    for(int i=1;i<=5;i++)
    {
        System.out.println("threadA : "+i);

    }
}
}
class B extends Thread
{
public void run()
{
    for(int i=1;i<=5;i++)
    {
        System.out.println("threadB : "+i);

    }
}
}

class ThreadPri
{
    public static void main(String args[])
    {
        A a =new A();
        B b =new B();
        a.setPriority(Thread.MIN_PRIORITY);
        b.setPriority(Thread.MIN_PRIORITY);
        a.start();
        b.start();

    }
}

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|