public class PingPong2 implements Runnable { private String Ping; private int delay; public PingPong2(String a, int b) { Ping=a; delay=b; } public void run() { try { for(; ;) { System.out.print(Ping + "\t"); Thread.sleep(delay); System.out.println("CurrentThread: "+Thread.currentThread()); } }catch(InterruptedException e) { System.out.println("Exception: "+e); } } public static void main(String[] args) { PingPong2 rn1 = new PingPong2("Ping1", 5000); PingPong2 rn2 = new PingPong2("Pong2", 200); Thread t1 = new Thread(rn1); Thread t2 = new Thread(rn2); t1.start(); t2.start(); } }