简单java程序问题求问
public class BreakExample {public static void main(String[] args){
int []arrayOfInts = {32,87,3,589,12,1076,2000,8,622,};
int searchfor =12;
int i=1;
boolean foundIt =false;
for(i=1;i<arrayOfInts.length;++i){
if(arrayOfInts[i] == searchfor){
foundIt = true;
break;
}
}
if (foundIt){
System.out.println("Found "+ searchfor +" at index "+( i+1));
}else{
System.out.println(searchfor+"not in the array");
}
}
}
System.out.println("Found "+ searchfor +" at index "+( i+1));
这一行代码后面的i+1能不能在前面实现,后面就输出i,结果为5呢