The Atomic classes in Java 5: AtomicInteger and AtomicLong,AtomicReference etc.
The AtomicInteger class has a number of uses, but one is a drop-in replacement for an atomic counter. Before Java 5, we had to write classes with access to the counter variable insynchronize