Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package demo2;
  2. class Runner implements Runnable
  3. {
  4.     public void run()
  5.     {
  6.         for ( int i = 0; i<10; i++)
  7.         {
  8.             System.out.println("Hello " + i);
  9.             try {
  10.                 Thread.sleep(100);
  11.             } catch (InterruptedException e) {
  12.                 e.printStackTrace();
  13.             }
  14.         }  
  15.     }
  16. }
  17.  
  18. public class App {
  19.     public static void main(String[] args) {
  20.         Thread t1 = new Thread(new Runner());
  21.         Thread t2 = new Thread(new Runner());
  22.        
  23.         t1.start();
  24.         t2.start();
  25.        
  26.     }
  27. }