I am stuck on this following piece of code I have been trying to use a bubble sort to sort the array of objects by surname then print it out. where Am i going wrong and how can i print it out? here is my code
for(int i = 1; i < clipArray.length; i++) {
for(int j = 0; j < clipArray.length; j++) {
if(((clipArray[j].getSurname()).compareToIgnoreCase((clipArray[j+1].getSurname()))) {
Clip temp = clipArray[j];
clipArray[j] = clipArray[j+1];
clipArray[j+1] = temp;
}
}
}
problem: required boolean, found int
compareToIgnoreCasereturns anint. You need to compare this result with another integer like< 0.