I'm pretty new to java and don't really know about these stuff and it's my first time writing these methods! of course I have no clue how I can write them.
will you check my Method and let me know what i'm doing wrong? thank you.
public static void sortByVehicleMakeModel(Vehicle[] vehicles) {
boolean swapped = true;
for(int y = 0; y < vehicles.length && swapped; y++) {
swapped=false;
for(int x = 0; x < vehicles.length - (y+1); x++) {
if(vehicles[x].getMake() && vehicles[x].getModel().compareTo(vehicles[x + 1].getMake() && vehicles[x].getModel())) {
swap(vehicles, x, x + 1);
swapped=true;
}
}
}
}
My error is on the second statemnet .compareto() The operator && is undefined for the argument type(s) java.lang.String, java.lang.String