title: Java - using AtomicInteger vs Static int
body: <p>While using multiple threads I have learnt to use Static variables whenever I want to use a counter that will be accessed by multiple threads.</p>
  
  <p>Example:</p>
  
  <p><code>static int count=0;</code> Then later in the program I use it as <code>count++;</code>.</p>
  
  <p>Today I came across something called <code>AtomicInteger</code> and I also learned that it is Thread safe and could use one of its methods called <code>getAndInrement()</code> to achieve the same effect.</p>
  
  <p>Could anyone help me to understand about using <code>static atomicInteger</code> versus <code>static int count</code>?</p>