10.Methods II (java)


#1

I add the metdo like the tittle says

In between the bark and main methods, add a method called run to the Dog class by typing:

but i get this text

Did you create the run method? Place it between the bark and main method.

my code below

class Dog{

int age;
public Dog(int dogsAge){
age=dogsAge;

}//const

public void bark(){
System.out.println("Woof!");
}//bark

public void run() {

}

public static void main(String[] args) {

Dog spike=new Dog(9);
spike.bark();

}//main

}//dog class


#2

@melmot,

You are missing 1 closing-curly-bracket-}
which closes of the Dog class

class Dog{

    int age;

    public Dog(int dogsAge){
        age=dogsAge;
    }

    public void bark(){
        System.out.println("Woof!");
    }//bark

    public void run() {
        //
    }
}  //<<<<<<<<<<Forgot this one !!

#4

thanks.


#5