class PingPong extends Thread {
	String word;
	int delay;

	PingPong(String whatToSay, int delayInterval) {
		word = whatToSay;
		delay = delayInterval;
	}
	public void run() {
		try {
			for (;;) {
				System.out.print(word + " ");
				sleep(delay);					//wait for delay ms
			}
		} catch (InterruptedException e) {
			return;								//end on any error
		}
	}

	public static void main(String[] args) {
		new PingPong("ping", 33).start();		//repeat 1/30 sec
			new PingPong("PONG", 100).start();		//repeat 1/10 sec
	}
}