public class ThreadRace extends Object implements Runnable
Fields Summary
static int
num
Constructors Summary
Methods Summary
public static void
increment()
int n = num;
//This next line gives the context switcher an ideal
//place to switch context.
System.out.print(num+" ");
//And when it switches back, n will still be the old
//value from the old thread.
num = n + 1;