I am new to Java and trying Insertion sort an array of Score which is from a text file. The text file has only a String name and int score value. I tried with the following code below:
public static void insertionSort(Score[] scores)
{
for(int i = 1; i < scores.length; i++)
{
int temp = scores[i];
int j = i - 1;
while(j >= 0 && scores[j] > temp)
{
scores[j + 1] = scores[j];
j--;
}
scores[j + 1] = temp;
}
}
The error says that Scores cannot be converted to Int. How do I solve this issue?