title: What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?
body: <p>What does <code>ArrayIndexOutOfBoundsException</code> mean and how do I get rid of it? </p>
  
  <p>Here is a code sample that triggers the exception:</p>
  
  <pre><code>String[] names = { "tom", "bob", "harry" };
  for (int i = 0; i &lt;= names.length; i++) {
      System.out.println(names[i]);
  }
  </code></pre>