public double isLargerThan(Relatable other) {
CirclePlus otherCirc = (CirclePlus)other;
if (this.getArea() < otherCirc.getArea())
return -1;
else if (this.getArea() > otherCirc.getArea())
return 1;
else
return 0;
}
This is my code, it keeps returning 0 in the final else statement but even when the conditions are met in the if/else if statements, it ignores them and just goes to the bottom and returns 0;
Can you help me to fix this? Also, just so I can learn more, can you explain why java is doing this?
Just the help will be okay too, thanks so much!
Aucun commentaire:
Enregistrer un commentaire