程序运行说什么数组错误,当时能编译,不能输出。。。。。。。
class BB{
int a[] = {1,4,22,3,2,0,55,11,10};
int n = a.length;
int erg = a[0];
int f(){
for (int i=0; i<=n; i++){
if (a[i]>erg)
erg = a[i];
else continue;
}
return erg;
}
}
public class AA{
public static void main(String args[]){
BB p1 = new BB();
System.out.println(p1.f());
}
}