Write a program to demonstrate multi thread program in java?

class MyThread1 extends Thread

{

      public void run()

      {

            System.out.print("Vikrant ");

      }

}

class MyThread2 extends Thread

{

      public void run()

      {

            System.out.print("Kumar ");

      }

}

class MultiThread

{

      public static void main(String arg[])

      {

            MyThread1 t1=new MyThread1();

            MyThread2 t2=new MyThread2();

            t1.start();

            t2.start();

      }

}

MultiThread.PNG

, , , , ,

Leave a Reply