我已經看過其他問題,但是,我這裏面臨不完全的問題, 這是當前的代碼,我有發現的最大值和陣列
public class Qn3 {
public static void displayHighestMark(String[] names,int[] marks, int count)
{
int mark = 0;
int currentArrayPosition;
for(int i=0;i <= names.length;i++)
{
if(mark <= marks[i])
mark = marks[i];
currentArrayPosition = i;
}
System.out.println(name[i]+" with marks "+mark);
}
public static void main(String[] args)
{
String[] names = new String[]{"jack","hello","A","b","c","d"};// = new String[];
int[] marks = new int[]{1,2,3,8,5,6};
displayHighestMark(names,marks, 45);
}
}
所以基本上我試圖找到標記數組中的最高標記。但我正在逐漸ArrayIndexOutOfBoundsException異常
的厚望
哦,男孩,你不希望那裏在Java中的高階編程? – akuhn