Classes Constructor 3/13


#1



Classes Constructor 3/13



Replace this line with your code.


#2

Hey.

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


#3

thanks now I am getting this message


#4

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


#5

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


#6

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.


#7

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


#8

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.


#9

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


#10

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


#12

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


#13