现在的位置: 首页 > 综合 > 正文

Java Review 12OutOfBounds

2013年08月19日 ⁄ 综合 ⁄ 共 341字 ⁄ 字号 评论关闭

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]);
}
}

}

1
2
3
4
5
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at cn.com.ch09.ArrayIndexOutofboundsExceptionTest.main(ArrayIndexOutofboundsExceptionTest.java:9)

【上篇】
【下篇】

抱歉!评论已关闭.