Не вижу где ошибка. Валидатор выдает строку 26. Возможно часть кода вне статического метода.
package com.javarush.task.task05.task0502;
/*
Реализовать метод fight
*/
public class Cat implements Comparable <Cat> {
public int age;
public int weight;
public int strength;
public int result;
public Cat() {
}
@Override
public int compareTo(Cat anotherCat) {
result =this.compareTo(anotherCat);
return result;
}
public boolean fight(Cat anotherCat) {
//напишите тут ваш код
if (result > 0) {return true; System.output.println("Кот1 победил");}
if (result < 0) {return false; System.out.println("Кот2 победил");}
if (result == 0) {return true; System.out.println("Ничья");}
} if (result == 0) {return true; System.out.println('Ничья');}
public static void main(String[] args) {
Cat cat1 = new Cat();
cat1.age = 2;
cat1.weight = 4;
cat1.strengh = 6;
Cat cat2 = new Cat();
cat2.age = 1;
cat2.weight = 6;
cat2.strengh = 7;
cat1.fight(cat2);
cat2 fight(cat1);
}
}
}