Saturday, January 14, 2012

7a Multiple Threading


//MULTITHREAD

class mul1 implements Runnable
{
  public void run()
   {
try
{
    for(int i=1;i<=10;i++)
    {
         System.out.println(i+"x2="+(i*2));
         Thread.sleep(800);
     }
  }        
  catch(Exception e)
    {     }    
 }
}
class multible
  {
 public static void main(String args[])

   {
    mul1 ob=new mul1();  
    Thread t1=new Thread(ob);
    Thread t2=new Thread(ob);
    Thread t3=new Thread(ob);

    t1.start();
    t2.start();
    t3.start();
   }
 }

No comments:

Post a Comment