title: creating final variables inside a loop
body: <p>is this allowed in java:</p>
  
  <pre><code>for(int i=0;i&lt;5;i++){
    final int myFinalVariable = i;
  }
  </code></pre>
  
  <p>The keyword of my question is <code>final</code>. Is it allowed to do a final variable that changes with every run of the loop? I was wondering this because final says that you can't change the value of the variable (calling only <code>myFinalVariable = i</code>), but i'm redefining the whole variable with <code>final int</code>. </p>
  
  <p>Are they two completely different variables just with the same name - with the variable from the previous run of the loop already heading down the road to the garbage collector?</p>