Считаю количество превосходящих характеристик.
Ни > 0 ни >1 не подходит =(
package com.javarush.task.task05.task0502;
/*
Реализовать метод fight
*/
public class Cat {
public int age;
public int weight;
public int strength;
public Cat() {
}
public boolean fight(Cat anotherCat) {
int dmg = 0;
if (this.weight > anotherCat.weight)
dmg ++;
if (this.strength > anotherCat.strength)
dmg ++;
if (this.age > anotherCat.age)
dmg ++;
//System.out.println(dmg);
return (dmg > 1);
}
public static void main(String[] args) {
/*Cat cat1 = new Cat();
Cat cat2 = new Cat();
cat1.age = 1;
cat1.strength = 1;
cat1.weight = 1;
cat2.age = 2;
cat2.strength = 3;
cat2.weight = 3;
System.out.println(cat1.fight(cat2));*/
}
}