Thread MAX_PRIORITY example

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 ThreadMax
{
    public static void main(String args[])
    {
        A a =new A();
        B b =new B();
        b.setPriority(Thread.MAX_PRIORITY);
        a.run();
        b.run();

    }
}

0 comments:

Post a Comment

 
 
 
 


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