package threaddemo;

/**
 * Simple demonstration of Java Threads
 * (Lecture 2: Java and Concurrency)
 * 
 * $Id: SimpleThread.java 24268 2009-01-23 19:58:15Z oscar $
 *
 */
class SimpleThread extends Thread {
	public static void main (String[] args) {
		// TwoThreadsDemo:
		new SimpleThread("Jamaica").start();
		new SimpleThread("Fiji").start();
	}
	public SimpleThread(String str) {
		super(str);		// Call Thread constructor
	}
	public void run() {	// What the thread does
		for (int i = 0; i < 5; i++) {
			System.out.println(i + " " + getName());
			try { sleep((int)(Math.random() * 1000));
			} catch (InterruptedException e) { } }
		System.out.println("DONE! " + getName());
	}
}