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??

7/13 Did you create a Dog object using the Dog constructor? Make sure you indicate an integer parameter

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.