Why wont my method for "10.Methods 11" work? class Dog { int age; public Dog(int dogsAge) { age = dogsAge; } public void bark(){ System.out.printIn("Woof!"); } public void run(to the dog class) { System.out.printIn("Your dog


#1



Replace this line with your code.


#2

if you could please paste your code and error not in the title but in an actual forum post then it will be easier to help you out.


#3

I have the same exact problem!! I reported the issue as a bug to CodeCademy..lets see how they respond.


#4

Yeah the problem for me at least is that it keeps displaying it like its an error, despite clearly working in the output. I did what they said in the instruction exactly too ironically enough. It seems to not recognize that the run method is indeed between bark and main methods, despite it being so.

(Edit): I actually found the solution, you have to work through one step at a time for some reason. I saw on another forum that they had the same issue, and they fixed it by what I had just suggested.


#5

what do you mean - work through one step at a time? run after each step? When I deleted all code - it still came up with the error (and the hint, "Did you call the bark method on the spike object? make sure you call it inside of the main method" - note - this is for step 9/13 from part 9, Using Methods; my apologies for posting in this section - it seems to be giving a similar error though).


#6

In short, yes, you have to run the code after each step, as evidently, the program at that point in time can't keep up with all the code at once. I was literally trying to figure that out for an hour until I ran across another forum that discussed this issue and that was how it was resolved. And that's not to mention that the program is picky with where you place the code as we all have come to know.


#7

Do this ex step by step.
1. just write
public void run() {

}
and, run
2. write the rest, then run


#8

Done, it's working. thank for you sharing.


#9

Why does it keep showing this error for me? I've even used 'get code' feature and yet it shows the same error!


#10

Don't do all at once. you have to do step by step.At first complete only first instruction then go for the second




you should create a new post.dont post on other's topic.


#11

I have also same problem @mohamed.saadat


#12

@hardeepthiara - I got it resolved, do it step by step instead of doing it
in one go. Do the first task in it & run it, then the 2nd task and so on.
Works fine :slight_smile:


#13

hello guys :smiley: im having the same problem but running one step at the time does not work for me for some reason. here's the code: public void bark() {

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

}

public void run () {

}
public static void main(String[] args) {


#14

perhaps its a bug or maybe it did not want run to take in any parameters like an int.


#15

you are great thank you


#16

this work
:heart_eyes:


#17

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