title: Java - can't change int value inside for-each loop
body: <p>This question looks hilariously obvious, however I can't see my fault...
  I'm declaring an int variable inside for-each loop and it looks like I can't modify it.</p>
  
  <pre><code>for(String tmp : list) {
          int i = 0;
          System.out.println("i = " + i);
          i++;
  }
  </code></pre>
  
  <p>List is a LinkedList that is not empty and exists somewhere in the code. The output is:</p>
  
  <pre><code>i = 0
  i = 0
  i = 0
  </code></pre>
  
  <p>Is it even possible to modify a value of int inside such loop? Thanks.</p>