1. Why we should use empty class constructor ?
2. I can't understand connection between method and main method !
3. I'm completely confused.
* I know that I ask question a lot but I'm just student.
package com.codegym.task.task05.task0502;
/*
Implement the fight method
*/
public class Cat {
public int age;
public int weight;
public int strength;
public Cat() {
}
public boolean fight(Cat anotherCat) {
//write your code here
if ((cat1.strength >= cat2.strength) && (cat1.weight >= cat2.weight) && (cat1.age >= cat2.age) ) {
return true ;
} else {
return false ;
}
}
public static void main(String[] args) {
Cat cat1 = new Cat() ;
cat1.age = 5 ;
cat1.strength = 9 ;
cat1.weight = 5 ;
Cat cat2 = new Cat() ;
cat2.age = 6 ;
cat2.strength = 10 ;
cat2.weigth = 6 ;
System.out.println(cat1.fight(cat2));
}
}