Possible Duplicate:
ArrayIndexOutOfBoundsException
How do I prevent the following message from showing:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at Test.main (Test.java:28 )
While compiling this code:
int [ ] a = { 2, 7, 8, 9, 11, 16 };
for ( int i = 0; i <= a.length; i++ )
System.out.println( a[i] ); // line 28 of class Test.java