What's wrong with my method code?



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() {

  public static void main(String[] args) {
      Dog spike = new Dog(2);


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:


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.