Посмотрел уже кучу вопросов и примеров, но у себя ошибку найти не могу совсем
package com.javarush.task.task05.task0502;
/*
Реализовать метод fight
*/
public class Cat {
public String name;
public int age;
public int weight;
public int strength;
public Cat() {
}
public boolean fight(Cat anotherCat) {
if (cat1.age*cat1.weight*cat1.strength>cat2.age*cat2.weight*cat2.strength)
return true;
else
return false;
public static void main(String[] args) {
Cat cat1=new Cat();
Cat cat2=new Cat();
cat1.age=2;
cat1.weight=25;
cat1.strength=10;
cat2.age=5;
cat2.weight=35;
cat2.strength=20;
cat1.fight(cat2);
cat2.fight(cat1);
}
}
}