Что не так с кодом? Как вообще решать без переменных?
Это то же самое, что пойти в магазин за продуктами без ценников. И рассчитать, хватит ли тебе денег. Плак
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 n = 0;
int m = 0;
int c = 0;
int age1;
int age2;
int weight1;
int weight2;
int strength1;
int strength2;
if(age1>age2)
n = 1;
else
n = 0;
if (weight1>weight2)
m = 1;
else
m = 0;
if (strength1>strength2)
c = 1;
else
c = 0;
int result = n+m+c;
boolean result1;
if (result>2)
result1 = true;
else
result1 = false;
return result1;
}
public static void main(String[] args) {
}
}