class mythread implements Runnable { String id; public mythread(String s) { id=s; } public void run() { for (int i=0;i<10000;i++) { System.out.print("I am "); System.out.println("thread "+id); } } // run } public class threads0 { public static void main(String[] args) { try { mythread mt1 = new mythread("A"); mythread mt2 = new mythread("B"); Thread t1 = new Thread(mt1); Thread t2 = new Thread(mt2); t1.start(); t2.start(); t1.join(); t2.join(); } catch (InterruptedException ie) {System.exit(1);} }// main }