public class PingPong extends Thread{ String word; int delay; /** * Constructor. */ public PingPong (String w,int d) { word=w; delay=d; } public void run() { int j; try{ for (j=1;j<10;j=j+1) { System.out.print(word+" "); sleep(delay); } } catch (InterruptedException e) { return; } } public static void main(String args[]) { new PingPong ("ping",30).start(); new PingPong ("pong",100).start(); } }