Simple thread example

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

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

    }
}
}

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

    }
}

0 comments:

Post a Comment

 
 
 
 


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