title: converting while loop to a for each loop
body: <p>I'm trying to rewrite this for loop into a for each loop.</p>
  
  <pre><code> int k = 0;
    while(k &lt; farmArray.length) {
       System.out.println(farmArray[k].getOwner());
       k++;
    }
  </code></pre>
  
  <p>This is what i've tried</p>
  
  <pre><code>int k = 0;
  for(int Farm:farmArray)
  {
    System.out.println(farmArray[k].getOwner());
   k += Farm;
  }
  </code></pre>
  
  <p>can anyone point me in the right direction? thanks.</p>