Using Methods 9/13 issues


#1



I have been running through the forums and attempting to find a solution to my issue thus far, but have gotten nowhere really. I am having the error message appear: "Did you call the bark method on the spike object?"
I don't know where I am going wrong here.

https://www.codecademy.com/en/courses/learn-java/lessons/object-oriented-programming/exercises/using-methods-1?action=lesson_resume&link_content_target=interstitial_lesson


class {

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


#2

I'm having the same problem and I can't find the solution...


#3

Hey there.

I see you have a class with no name on the very first line. This is not needed, only the Dog class is needed.

Therefore you'll need to get rid of the first line and the corresponding closing curly brace that goes with it in order for there to be no more issues.


#4

Well, thank you very much. I was so confused.

From Tech Raiders, Team 4490!


#5

A post was split to a new topic: 9. I am having the error message appear


#6