5/13 create constructor parameters

class Dog {

int age;

public Dog( int dogsAge) {
age = dogsAge;

public static void main(String args) {
int age;

}

}
}

Leave this empty for now. Remove, int age;.

I am stuck on 5 /13 can someone pls tell whats wrong with this code
class Dog{

public Dog(int dogsAge;)
( public static void main(String args)
{

}
}

}

public Dog(int dogsAge);

u forgot the semicolon in the clip

its still not working
see if this code is right

class Dog{
int age;
public Dog (int dogsAge);
( public static void main(String args);

       { 

}
}

}

There shouldn’t be a semi colon after the constructor.
Your brackets are wrong . The order of curly braces are always like this .
public Dog (int dogsAge)
{
}
Same goes for the main class declaration. Remove the semi colon.

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