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


#1

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


Instructions 10 first part error
#2

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


#3

Have the same problem. still not solved.


#4


#5

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


#6
  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.

#7

tnx for your help :heart:


#8

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


#9

You are a life saver! Thanks a lot.


#10

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


#11

Thank you so much.. You're great...


#12

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


#13

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

}

}


#14

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

}

#15

I can continue writting until Step 3:

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


#16

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"?


#17

Brent, just write:

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

and press Run button.


#18

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


#19

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


#20

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.