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 trialKrondor The Destroyer
1,556 PointsNow that you've created the GoKart class. Please create a new GoKart object using the GoKart class, or blueprint. As you
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.
2 Answers
Kevin Faust
15,353 PointsHey Marco,
First you create a new Go Kart object and you pass it a color string as a constructor value:
GoKart gokart = new GoKart("red");
Then call the getColor() method on our GoKart object and then print it out!
System.out.printf(gokart.getColor());
Happy coding and best of luck,
Kevin
Krondor The Destroyer
1,556 Pointsthanks
lorve joinville
2,735 Pointslorve joinville
2,735 Pointskevin, can you help me, I had the same code as what you have written and i still get an error
./Example.java:6: error: cannot find symbol System.out.printf("The color of the kart is %s", redKart.getColor()); ^ symbol: variable redKart location: class Example 1 error