Q:

Java - Multithread concept

0

This Program is used to demonstrate the Multi Thread Concept.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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();

   }

}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now