Learn java 10.Method II


#1



https://www.codecademy.com/courses/learn-java/lessons/object-oriented-programming/exercises/methods-2?action=lesson_resume


The instruction says to write a method 'run' for the class Dog in between Bark and Main(two already written methods).
I did the same but error came.
Error says:Did you create the run method? Place it between the Bark and main method.
Pls help I'm a beginner.

Replace this line with your code.


#2

Yo,

I had this problem too, but it went away by finishing the rest of the steps in the lesson and running it. I think it might be a bug, ¯\(ツ)/¯. Godspeed.


#3

same prob here aswell


#5

i am having the same problem here


#6

this is stupid. It won't let me pass this section with the same stupid error which asks me to place the run method between the bark and main method.

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

}


#7

I saw couple of people struggling with this part of the exercise. Please find the attached screenshot. I hope it will help!


#8

Here is the full solution!


#9

Sometimes the code is right but you have to use a different browser. The photo that zabideen1 posted was perfect. Also scriptninja17250, I tried your code and it worked fine on all browsers. Hope I helped!


#10

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