8. Methods I

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

I can’t find anything wrong with my code. Here is it:

class Dog {

int age;

public Dog(int dogsAge) {

age = dogsAge;

}

public static void main(String[] args) {
public void bark() {
  System.out.println("Woof!")
}
Dog spike = new Dog(5);

}

}

<do not remove the three backticks above>

Soo in summary you’re saying that there’s no problem here?

What I meant was that I have a problem, but I can’t find it.

If you say that there is a problem but don’t explain what the problem is, then there isn’t a whole lot to go by.

While others COULD run your code and start guessing what you think is wrong about it, the responsibility of finding out what is wrong is entirely yours. You’ll have to ask questions which lead you to finding out how to repair your code.

Hi,

I believe that you created the bark method in the wrong place.
You have to create the method before the main method.
I hope it helps.

you forgotten semicolon

1 Like