Я в 39-й строке написал return, но он просит меня опять вести? Если уберу условие последнее и просто напишу else return false, то ни каких проблем нет. Почему проблемы?)
package com.javarush.task.task05.task0502;
/*
Реализовать метод fight
*/
public class Cat {
public int age;
public int weight;
public int strength;
public Cat() {
}
boolean fight(Cat anotherCat) {
int point1 = 0;
int point2 = 0;
if(this.age >= anotherCat.age)
point1++;
else
point2++;
if (this.weight >= anotherCat.weight)
point1++;
else
point2++;
if (this.strength >= anotherCat.strength)
point1++;
else
point2++;
if (point1 > point2)
return true;
else if(point1 < point2)
return false;
else if(point1 == point2)
return false;
}
public static void main(String[] args) {
Cat cat1 = new Cat();
cat1.age = 10;
cat1.weight = 10;
cat1.strength = 10;
Cat cat2 = new Cat();
cat2.age = 1;
cat2.weight = 1;
cat2.strength = 1;
System.out.println(cat1.fight(cat2));
System.out.println(cat2.fight(cat1));
}
}