All pastes #908624 Raw Edit

Something

public java v1 · immutable
·published 2008-02-18 17:04 UTC
rendered paste body
import java.util.Vector;public class Main {	public static void main (String[] args) {				int numThreads = 4;				Book b = new Book();				System.out.println("Number of threads: " + numThreads + "\n");		Vector threads = new Vector();				// Create our threads in a loop 		for (int i=0; i<numThreads; i++) {						//Worker w = new Worker(i, b);			threads.add(new Thread(new Worker(i, b)));		}					for (int i=0; i<threads.size(); i++) {			Thread t = (Thread) threads.elementAt(i);			t.start();		}						try {			Thread.sleep(1); 		}		catch (InterruptedException e) {};				System.out.println("Interrupting");		for (int i =0; i<threads.size(); i++) {			Thread t = (Thread) threads.elementAt(0);			t.interrupt();		}	} 		}