Classes Constructor 3/13


<Below this line, add a link to the EXACT exercise that you are stuck at.>
Classes Constructor 3/13

<In what way does your code behave incorrectly? Include ALL error messages.>


Replace this line with your code.

<do not remove the three backticks above>


Your Dog constructor’s closing brace is in the wrong place. It should be before the main method not after it.

thanks now I am getting this message

Hey, Almost there. Just one too many closing curly braces after Dog()

Does it matter what lines the code is on? Here is my latest error.

Okay let’s do this:

class Dog { // This is the beginning of our dog class

    // This is where we put variable and methods that make sense to use for a Dog object.

   public Dog() { // this is a special kind of method. It's a constructor. Notice it has the same name as the Dog class. This is how we know it's a constructor.

   // When we want to create a new instance of Dog class we use this constructor 
   // to set up some default values


   public static void main(String[] args) {

   // this is the main method. This is the method that java looks for so that the program
   // can run. It's the key to the rest of the program


} // this is the end of our dog class

That should work. If you don’t understand some of the terminology don’t worry, the course should cover it.
But I hope you got something by looking and analyzing that.

1 Like

I am not getting an error but it won’t let me go to the next screen.

This can happen sometimes.

Copy your code. Go to the bottom right where it says “Get Help” and select to restart the exercise. Paste your code back and with any luck it should let you proceed onto the next exercise.

1 Like

I reset the exercise and it worked. I think it may matter what lines the code was put on. Thanks for your help.

2 posts were split to a new topic: It is still giving me no error message but says I’ve done the exercise wrong

A post was split to a new topic: It is still asking for the class constructor when its already there