5/13 create constructor parameters


#1

class Dog {

int age;

public Dog( int dogsAge) {
age = dogsAge;

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

}

}
}


#2

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


#3

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)
{

}
}

}


#4

public Dog(int dogsAge);

u forgot the semicolon in the clip


#5

its still not working
see if this code is right

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

       {

}
}

}


#6

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.


#7

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