12.instance : did you call checkstatus method of main?


#1

i have been checking this error but still i' stuck with this exercise
i had created the checkstatus method but still getting this -->>did you call "checkstatus" method of main?

heres my code:
class Dog extends Animal {

int age;

}

public Dog(int dogsAge){
age = dogsAge;

}

class check(){
public void checkStatus(){
System.out.println("The battery is fully charged and ready to go!");
}

public void bark(){
System.out.println("Woof!");

}
public void run(int feet){
System.out.println("Your dog ran" +
feet + "feet!");
}
public int getAge(spikeAge){

return age ;

}

public static void main(String[] args) {

//spike object
Dog spike = new Dog(2);
spike.checkStatus();
spike.bark();
spike.run(12);
int spikeAge = spike.getAge();
System.out.println(spikeAge);

}

}


#2

You have created a whole new Method, that you've copy and pasted from the Car example, delete this;

Then after extending the Dog class, just call the animal method with spike.checkStatus();


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.