Why isn't this working help!


#1

Not sure why this won't work, im not getting an error message but according to code academy im doing something wrong. Anyone?



class Dog {
  
  int age;

    public Dog(int dogsAge) {
    
      age = dogsAge;
  }
      public void bark() {
 System.out.println("Woof!");
      }
    public void run(int feet) {
    
    System.out.println("Your dog ran " + feet  + " feet!");
    
  }
    public static void main(String[] args) {
  
      
    
    Dog spike = new Dog(5);
spike.bark();
 spike.run(500);
    }

}


#2

What's it's saying you do wrong? What exercise is it?


#3

Its saying " Did you create the run method? Place it between the bark and main method."


#4

Its excersize 10/13 of the Methods II portion of Learn java


#5

Completing the checkpoint that follows interferes with passing that one. One at a time I guess.
They search for very specific patterns of text in your code, in this case:

/[Oo][Oo][Ff]\s*!?\s*"\s*\)\s*;\s*\}\s*public\s+void\s+run\(\s*\)\s*\{\s*\}\s*public\s+static/

Which has only whitespace inside the method and its argument list


#6

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