По этой причине не принимает задачу. Что подразумевается под этим? Я вроде не скопом их сравниваю? Или как?
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 a=0,b=0,c=0, d=0;
if (this.age > anotherCat.age)
a=1;
if (this.weight > anotherCat.weight)
b=1;
if (this.strength > anotherCat.strength)
c=1;
d = a+b+c;
if (d >= 2)
return true;
else
return false;
}
public static void main(String[] args) {
Cat Vaska = new Cat();
Vaska.age = 2;
Vaska.weight = 7;
Vaska.strength = 10;
Cat Murzik = new Cat();
Murzik.age = 2;
Murzik.weight = 7;
Murzik.strength = 10;
Vaska.fight(Murzik);
System.out.println(Vaska.fight(Murzik));
}
}