Why it does not work?

class Dog {

int age;

public Dog(int dogsAge) {

age = dogsAge;

}

public static void main(String[] args) {

 Dog spike = new Dog (9);
}

}

Why it does not work??

For some reason there can’t be a space between Dog and (9); :slight_smile:

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