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 trialOskar Pihlak
2,094 PointsConfused
I think I didn`t quite understand this. Watched the videos a couple times.
public class GoKart {
public String mGoKart = new GoKart("color");
mGoKart= GoKart;
public static void main(String[] args) {
System.out.println("We are going to create a GoKart");
}
}
1 Answer
James Vaughan
Courses Plus Student 4,462 PointsHi Oskar,
I've just had a look at the code challenge and I'm not sure what you've done in the source code above. The question provides you with:
public class Example {
public static void main(String[] args) {
System.out.println("We are going to create a GoKart");
}
}
The question then asks you to: create a new GoKart object using the GoKart class, passing a single parameter of the colour.
Adding the line:
GoKart goKart = new GoKart("blue");
Below the System.out... line should complete the challenge. That line means:
Create an object of type GoKart called goKart, use the constructer in the GoKart class to create this object and pass into that constructer the string "blue" (which is the colour).
Hope that helps.
yadin michaeli
Courses Plus Student 5,423 Pointsyadin michaeli
Courses Plus Student 5,423 PointsHi oskar,
like james say you need to create the object after public static void main(String[] args) { GoKart goKart = new GoKart("blue");
above the main method this place call class and this is where you set fields...hope it make sense for you :)