Java

Java - Multithread concept

Java - Multithread concept
class threa3 extends Thread

{ 

public void run()

   {

    try

      {   

        Thread.sleep(8000);

        System.out.println("\nWELCOME");

       }

      catch(Exception e)    { }

   }      

 }

class threa2 extends Thread

{ 

  public void run()

   {

     try

      {    

       Thread.sleep(4000);

       System.out.println("\nGOOD DAY");

      }

     catch(Exception e)    { }

   }      

}

class threa1 extends Thread

{ 

public void run()

   {

  try

   {    

 Thread.sleep(1000);

 System.out.println("\nHAI");

   }

catch(Exception e)    { }

  }       

 }

public class Mythread

 {

  public static void main(String arg[])

   {

     threa3 t3 = new threa3();     

     t3.start();

     threa2 t2 = new threa2();      

     t2.start();

     threa1 t1 = new threa1();    

     t1.start();

   }

}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.