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
随时随地看视频慕课网APP
相关分类