Good day,what does it mean identifier missing?
Usually is when declaring a variable and missing the type.
Here i don't understand in the invoking of method
package com.codegym.task.task05.task0505;
/*
Feline carnage
*/
public class Solution{
public static void main(String[] args){
}
Cat ca1 = new Cat("ADJUSTED",4,5,6);
Cat cat2 = new Cat("TV",5,6,7);
Cat cat3 = new Cat("Little",8,7,6);
System.out.println(ca1.fight(cat2));
System.out.println(cat2.fight(cat3));
System.out.println(ca1.fight(cat3));
//public class Solution {
//public static void main(String[] args) {
//write your code here
}
public static class Cat {
protected String name;
protected int age;
protected int weight;
protected int strength;
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 ageAdvantage = this.age > anotherCat.age ? 1 : 0;
int weightAdvantage = this.weight > anotherCat.weight ? 1 : 0;
int strengthAdvantage = this.strength > anotherCat.strength ? 1 : 0;
int score = ageAdvantage + weightAdvantage + strengthAdvantage;
return score > 2; // return score > 2 ? true : false;
}
}
}