String shuzu4[]={"sports", "game","movie"};
System.out.println("循环输出数组中元素的值:");
for( int i=0;i<=shuzu4.length; i++){
System.out.println(shuzu4 [i] );
显示是这样的
循环输出数组中元素的值:
sports
game
movie
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at com.chen.shuzu3.main(shuzu3.java:10)
sxian_wang
相关分类