I have an unsorted array of objects. I need to know how I can sort my array in descending order, according to the highest value inside the objects.
I need to do this using for loops, not the easy way.
I had done this but it seems there is a problem:
student[] temp=new student[s.length];
for (int i=0;i<s.length;i++)
{
if (s[i].GetGpa() > s[i + 1].GetGpa())
{
temp[i] = s[i];
}
}
How should I do it using for loops?