title: Reference to the iteration number in Java's foreach
body: <p><strong>How can you refer to the index of an array in the foreach?</strong></p>
  
  <p>My code</p>
  
  <pre><code>String[] name = { "hello", "world" };
  for ( int k : name[k] ) {
     --- cut ---
  }
  </code></pre>
  
  <p>I expecting that the foreach -loop will </p>
  
  <pre><code>1. set k = 0 in first iteration so that name[0] works correctly
  2. set k = 1 in the next iteration...
  </code></pre>
  
  <p>I get the error message</p>
  
  <blockquote>
    <p>foreach not applicable to expression type</p>
  </blockquote>