Java program for threads by implementing runnable interface

 class A implements Runnable 

{

public void run()

{

System.out.println("Hello");

}

}

class Demo

{

public static void main(String ar[])

{

System.out.println("One");

A ob = new A();

Thread t = new Thread(ob);

t.start();

System.out.println("Two");

}

}


OUTPUT










Comments