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

THIS ISN'T LIKE THE VIDEO!!! AAAHHHH!!!

I'm trying translate what I learned from the video but it isn't going well, to say the least! I'm getting lost and frustrated primarly becuase I do not like not understanding something. Can someone explain where I am going wrong and why?!

Example.java
public class Example {

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

2 Answers

Hanley Chan
Hanley Chan
27,771 Points

This worked for me for creating a new GoKart object

        GoKart mykart = new GoKart("blue");

Hi,

I had the same problem when I did that course. Hanley was right. The reason it wouldn't work was because you have to declare a String outside of all curly brackets (except for the first one after the class name) and then you have to declare what mColor is, "blue", if you want to put in a different color it doesn't matter.

Hope this helps.