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

Stuck on 2nd last quiz question How to make a object

When i try to make the object it keeps saying use the new keyword but i don't know what the keyword is!

Example.java
public class Example {

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

  public class GoKart{
   public String getColor;
  }



};
amathiaitishar
amathiaitishar
13,229 Points

Instantiation: The new keyword is a Java operator that creates the object. Initialization: The new operator is followed by a call to a constructor, which initializes the new object.

1 Answer

Adam Sommer
Adam Sommer
62,470 Points

The GoKart class was created in the previous step, and this step is asking you to create a new instance of the GoKart class. Something like:

GoKart goKart = ...

You don't need to define the GoKart class again.