Дорогие друзья, почему при компиляции выдает ошибку <identifier> expected ? в 22 строке
package com.javarush.task.task05.task0505;
/*
Кошачья бойня
*/
public class Solution {
public static void main(String[] args) {
//напишите тут ваш код
}
public static class Cat {
protected String name;
protected int age;
protected int weight;
protected int strength;
Cat cat_1 = new Cat("barsik", 10, 22, 30);
Cat cat_2 = new Cat("ba", 11, 23, 31);
Cat cat_3 = new Cat("b", 12, 24, 32);
System.out.println((cat_1.fight(cat_2)));
System.out.println(cat_1.fight(cat_3));
System.out.println(cat_2.fight(cat_3));
public Cat(String name, int age, int weight, int strength) {
this.name = name;
this.age = age;
this.weight = weight;
this.strength = strength;
}
public boolean fight(Cat anotherCat) {
int ageScore = Integer.compare(this.age, anotherCat.age);
int weightScore = Integer.compare(this.weight, anotherCat.weight);
int strengthScore = Integer.compare(this.strength, anotherCat.strength);
int score = ageScore + weightScore + strengthScore;
return score > 0; // return score > 0 ? true : false;
}
}
}