package cn.com.ch09;
public class ArrayIndexOutofboundsExceptionTest
{
public static void main(String[] args) {
int [] i=new int[]{1,2,3,4,5};
for(int j=0;j<6;j++)
{
System.out.println(i[j]);
}
}
public class ArrayIndexOutofboundsExceptionTest
{
public static void main(String[] args) {
int [] i=new int[]{1,2,3,4,5};
for(int j=0;j<6;j++)
{
System.out.println(i[j]);
}
}
}
1
2
3
4
5
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at cn.com.ch09.ArrayIndexOutofboundsExceptionTest.main(ArrayIndexOutofboundsExceptionTest.java:9)