Understanding the need for Thread-Safe variables using a basic counter in Java