package atomicvolatile;

import java.util.concurrent.atomic.AtomicInteger;

public class ExampleIncrement implements Runnable{
	int nothing = 0;
	volatile int vola = 0;
	AtomicInteger atom = new AtomicInteger(0);
	
	public void run() {
		// try to increment all three methods
		for (int i = 0; i < 10; i++) {
			nothing ++;
			vola ++;
			atom.incrementAndGet();
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
