Hello,
I am stuck at this lesson,
“Using Methods: I”
I followed instructions, inserted the:
spike.bark();
However, after clicking on RUN, although the “Woof!” appear on console execution there is a message in red at the botton of screen:
“Did you call the bark method on the spike object? Make sure you call it inside of the main method.”
Well… I am stuck here… any help?
Thanks for the attention.
======Dog.java======
class Dog {
int age;
public Dog(int dogsAge) {
age = dogsAge;
}
public void bark() {
System.out.println("Woof!");
}
public static void main(String[] args) {
Dog spike = new Dog(5);
spike.bark(); // I inserted this code
}
}