The isOld method tests if int age is < 15. I've already complied the class and it comes with no errors, but when I try to call the method from another class it causes an error method isOld in class Pet cannot be applied to given types;
public static void isOld(int age)
{
if(age > 15)
System.out.println("true");
}
This is the PetRunner class:
import static java.lang.System.*;
public class PetRunner{
public static void main( String[] args )
{
System.out.println("Pets");
Pet cat = new Pet ("Lolo", 20);
Pet dog = new Pet ("Buster", 40);
System.out.println(cat);
System.out.println(dog);
cat.isOld();
dog.isOld();
Aucun commentaire:
Enregistrer un commentaire