Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Create thread in java (Java)

Create thread in java

COMPLETE SOURCE CODE FOR CreateThread.java

public class CreateThread implements Runnable
{
   //all thread implementation will be put in run method
   public void run()
   {
       //Print hi
       System.out.println("HI");
   }

   public static void main(String[]args)
   {
       //Create thread by create CreateThread object
       CreateThread a=new CreateThread();
    
       //run the thread
       a.run();
   }
}


JUST COMPILE AND EXECUTE IT