What's wrong with my method code?

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/learn-java/lessons/object-oriented-programming/exercises/using-methods-1?action=resume

<In what way does your code behave incorrectly? Include ALL error messages.>
Did you call the bark method on the spike object? Make sure you call it inside of the main method.

```

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(2);
spike.bark();
}
}

<do not remove the three backticks above>

Hey @designninja33974

It looks like a small problem, not with your code, but with the lesson. If you look at your bark method, it says “Woof” when the instructions ask for “Woof!”. Simple fix: Place the exclamation point inside. This should fix it. The reasoning behind this is because the lesson creator makes it look for the output of “Bark!” (with the exclamation) and it will register as the bark method not running if it isn’t there. It should fix your problem. Hope this helps. Good luck. :coffee:

1 Like

A post was split to a new topic: Same problem

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