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 trial

Java Java Objects (Retired) Meet Objects Creating New Objects

Gonzalo Torres del Fierro
PLUS
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

Now that you've created the GoKart class. Please create a new GoKart object using the GoKart class, or blueprint. As you

how to do it?

Example.java
public class Example {

    public static void main(String[] args) {
        System.out.println("We are going to create a GoKart");
       Gokart gokart = new GoKart("Red");
        System.out.printf("The GoKart color is %s\n",
                          gokart.getGoKart());
    }
}

4 Answers

It should be structured like this:

GoKart goKart = new GoKart("Red");
System.out.printf(goKart.getColor());

Make sure this code is inside of your method main body. this is all of the code that you need to add.

I just realized that when you went to initialize the GoKart class you spelled the class Gokart instead of GoKart; that will throw an error all by itself.

Yes keep at it. When you were in kindergarten learning your ABCs did you have them all memorized after hearing them and seeing them once- probably not. It took repetition; Java is no different, you have to keep working at it in order for it to sink in. Even if you do get to the point where you understand it if you don't keep it fresh in your mind you can still forget stuff. Just keep at it :)

Okay good, you're welcome.

Gonzalo Torres del Fierro
PLUS
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

Sarantis, keep working. yes it is hard, sometimes, you feel you are "cheating" your self, but try by all means, to face every problem and no matter how long it takes. (this is your choice to learn, nobody else but you this is important) At the biginning you will create bad solutions, with many mistakes on syntax, and logic, but from a moment (clic time) that can not explain, you will get the idea, and your brain it is gonna get it. trust me Sarantis, i was there in your shoes just a few days ago......