8. Methods I


#1



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

	}

}


#2

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


#3

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


#4

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.


#5

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.


#6

you forgotten semicolon