Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJari Koopman
Python Web Development Techdegree Graduate 29,349 PointsI have lost it... can't make the second Challenge.
I had a lot of problems making the first challenge, but finally found out how it worked. Now I got to the Challenge Task 1 of 2 and I think I even don't get the question. (Now that you've created the GoKart class. Please create a new GoKart object using the GoKart class, or blueprint. As you know it takes a single parameter, color when being built.) I red the explanation at other questions but still can't get it clear with all the things like Class, Method, Constructor, Object and parameter etc. So, please can someone help me out and explain what I have to do in this Challenge? I think I lost it because of the names GoKart class, and now create an GoKart object. (I'm Dutch, so maybe it is my English that makes it to difficult, but I still want to go on if possible...)
public class Example {
public static void main(String[] args) {
System.out.println("We are going to create a GoKart");
GoKart gokart = new GoKart();
System.out.printf("The gokart is %s",gokart.getColor());
}
}
2 Answers
Grigorij Schleifer
10,365 PointsHey jari,
donΒ΄t feel lost ... you will get it I promise :)
Look at my code suggestion:
public class Example {
public static void main(String[] args) {
System.out.println("We are going to create a GoKart");
GoKart gokart = new GoKart("Red");
// Red is the color parameter
// it is a String
// and you can get it using a getter method like getColor()
System.out.printf("The color is %s\n", gokart.getColor());
// after you created a new instnce of the GoKart class
// instance is the same as object
// you can access methods and variables of your GoKart class
// the GoKart object is called gokart right ....
// so call it and then use the "." sign
// "." sign is like a long arm thet gets you almost everething from the class
// here our method getColor() that returns the color you passed as parameter
// here "Red"
}
}
If you need more help, let us know. The forum will help you :)
Grigorij
Jari Koopman
Python Web Development Techdegree Graduate 29,349 PointsHi Grigorij, Thank you so much for your quick and helpful reply, and now I see I was getting close to the solution! Happy again!
Grigorij Schleifer
10,365 PointsHey Jari,
you are very welcome !
Glad I could help
Grigorij