So at the end of the function, the return is: return sum > 2;
What is the purpose of the > 2?
public class Cat {
public int age;
public int weight;
public int strength;
public Cat() {
}
public boolean fight(Cat anotherCat) {
int ageResult = this.age < anotherCat.age ? 1 : 0;
int weightResult = this.weight < anotherCat.weight ? 1 : 0;
int strengthResult = this.strength < anotherCat.strength ? 1 : 0;
int sum = ageResult + weightResult + strengthResult;
return sum > 2;
}
public static void main(String[] args) {
}
}