the second part of the extends exercise:
“Within the main method of the Dog class, call the checkStatus method on the spike object.”
it is not ok to add the " spike.checkStatus();" at the beginning of main, like this:
public static void main(String[] args) {
spike.checkStatus();
Dog spike = new Dog(5);
spike.bark();
spike.run(40);
int spikeAge = spike.getAge();
System.out.println(spikeAge);
But it is ok if it’s typed below the last line (below println). Why?
spike is an instance of Dog class. You have to create the spike instance first before you can use the new object spike with the classes methods.
You don’t have to use it after the println statement you have in your code. You can use it anywhere after your object declaration.