I write test with like this .but error


#1

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(23);
           }

}


#2

what is the error massage you are getting and can you please post the lesson link?


#3

my error message is
Did you create the run method? Place it between the bark and main method.
https://www.codecademy.com/courses/learn-java/lessons/object-oriented-programming/exercises/methods-2?action=lesson_resume&link_content_target=interstitial_lesson


#4

you have to do step by step.you can't do all at once.
At first do step 1

public void run() {

}

then after running the code go step 2


#5

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