10. Methods: II, Did you create the run method?

I am having the same problem with Java methods - No 10?
Cheers Annette

Please post a screenshot so I can see what you see.

1 Like

Have the same problem. still not solved.

Could you solve the problem???
I have got the same problem as you!

  1. Execute the code after creating run method as given in the Instructions(Step1)
    Step1:
    public void run() {
    }
  2. Now the error will be resolved, then we will be able to proceed.
4 Likes

tnx for your help :heart:

same probs what have u done ?? i couldnt go ahead

You are a life saver! Thanks a lot.

Didn’t go any further. Got stuck.
My code is correct. Even then, it says You didn’t create the run Method!!
Place it in between main method and bark method.
But I get the output all the time when i run the program.
:-p

1 Like

Thank you so much… You’re great…

I have tried to get past lesson 10 but even with the get code thing, it still doesn’t work :cry:

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(5);

}

}

I am stuck on the first instruction, I have literally typed the run method between the bark and main method and it whilst the code will run, the instruction will not progress.

eg.

public void bark() {

System.out.println("Woof!");

}

public void run() {

}
public static void main(String args) {

Dog spike = new Dog(5);
spike.bark();

}
1 Like

I can continue writting until Step 3:

public void run(int feet) {
System.out.println("Your dog ran " + feet + “feet!”);
}

I still don’t get it. Are you saying just to hit “run” after adding the code in step1? Cause that’s doing nothing for me. What exactly do you mean by “execute the code”?

Brent, just write:

public void run(int feet) {
System.out.println("Your dog ran " + feet + “feet!”);
}

and press Run button.

1 Like

I can’t get it I write between the bark and main method
public void run() {
}
And it still does not work

no the error still there…what to do, plz tell me

Your best bet is to keep spamming it until it gives you the “Need help?” prompt. I had it fill it in and run it automatically so it could work, then I retyped it to prove I wasn’t the one doing it wrong.