title: Printing words from an array in reverse
body: <p>I have a task where I need to print words from an array in reverse(the word itself). This is what the task states :</p>
  <blockquote>
  </blockquote>
  <ol>
  <li><p>Create an array of words called ‘wordList’ and assign the values ‘Stressed’, ‘Parts’, ‘Straw’, ‘Keep’, ‘Wolf’</p>
  </li>
  <li><p>Create a string called ‘reversedWord’ and do not assign it a value.</p>
  </li>
  <li><p>Similar to the above challenge, however, instead of reversing a sentence, reverse the order of the letters</p>
  </li>
  </ol>
  <p>within each string.</p>
  <p>a. You will need to create a for-loop to access each word in turn. Immediately within the loop set</p>
  <p>‘reversedWord = “”;’</p>
  <p>b. Then create another for-loop inside of the first one to iterate backwards through the current</p>
  <p>word. Update the value of ‘reversedWord’ on each iteration.</p>
  <p>c. Print the reversed word on the screen.</p>
  <p>STRETCH CHALLENGE: Handle the word so that it reads properly backwards. (Stressed becomes Dessert)</p>
  <p>I don't know wether I'm just not understanding the wording of the task or not, but this is the code I have at the moment:</p>
  <pre class="lang-java prettyprint-override"><code>String[] wordList = {&quot;Stressed&quot;, &quot;Parts&quot;, &quot;Straw&quot;, &quot;Keep&quot;, &quot;Wolf&quot;};
  String reversedWord;
  
  for (int i = wordList.length; i &gt;= 0; i++) {
      reversedWord = &quot;&quot;;
      for (int j = wordList[i].length() - 1; i &gt;= 0; j--) {
          reversedWord += wordList[i].charAt(j);
          System.out.println(reversedWord);
      }
  }
  </code></pre>
  <p>It gives me this error when i run it:</p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 5
      at Main.main(Main.java:22)
  </code></pre>
  <p>Any help explanation would be helpful.</p>