8. Methods I


#1



I cannot find anything wrong with my code. Here is my code:

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

Hi firestarwang,

Hint: We always define methods inside the class and not inside another method. Think about your bark and main methods :wink: