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

GOKart problem asks me to creat an object with new keyword and I already typed the new keyword.

What did i do wrong?

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("blue");
}

1 Answer

Michael Hess
Michael Hess
24,512 Points

Hi Shree Devi,

Everything is looking good, except the goKart object should go inside of the main method body.

Please see the following example:

public class Example {

    public static void main(String[] args) {
        System.out.println("We are going to create a GoKart");

      GoKart goKart = new GoKart("blue");

    }  //end main
} // end Example

If you have any further questions feel free to ask! Hope this helps!