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 trialmike LaBianca
Courses Plus Student 2,456 Pointsneed help on this one, i know i am close
just need to know what else i am missing.
public class Example {
public static void main(String[] args) {
System.out.println("We are going to create a GoKart");
GoKart parameter = new GoKart("red");
System.out.printf("The color of the Go Kart is %s", getColor());
}
}
2 Answers
Ryan Ruscett
23,309 PointsHey,
You are right, really close.
You called getColor(). But on what? You created an object called parameter. So you call getColor() on the object you created.
parameter.getColor()
public class Example {
public static void main(String[] args) {
System.out.println("We are going to create a GoKart");
GoKart parameter = new GoKart("red");
System.out.printf("The color of the Go Kart is %s", parameter.getColor());
}
}
Let me know if that solves your issue.
Thanks!
Syed Sayem
11,327 PointsWhere did you create getColor() method? I don't see in Example class. Did you create in GoKart class? If you did, run this code:
public class Example {
public static void main(String[] args) {
System.out.println("We are going to create a GoKart");
GoKart parameter = new GoKart("red");
System.out.printf("The color of the Go Kart is %s", parameter.getColor());
}
}
Ryan Ruscett
23,309 PointsThe get color isn't created in the Example class. It's int he GoKart class. Which color is a part of the GoKart Object being used in the constructor of the object.