【发布时间】:2014-07-12 16:27:25
【问题描述】:
class test3
{
public static void main(String[] z)
{
int a[]={123456789};
for(int i=0;i<=a.length;i++)
{
System.out.println("hello");
if(a[i]<=a[i]) //is this a right way
System.out.println("min"+a[i]);
if(a[i]>=a[i-1]) //is this a right way
System.out.println("max="+a[i]);
else
System.out.println("error");
}
}
}
在线程“main”中出现以下异常
java.lang.arrayindexoutofbound exception -1 at test3.main(test3.java:9)
【问题讨论】:
-
这段代码有很多问题,我不知道从哪里开始。
-
sry :P @OliCharlesworth m 只是个大人物。