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

compiler error for my code. please help

In don't understand what is wrong with my code. I'm sure it will seem dumb and obvious, but I need some help.

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 color is %s\n",gokart.getColor());
    }
}

2 Answers

Hi Uriah,

You created the object and called it goKart then missed out the capital K when you used it.

GoKart goKart = new GoKart("red");
System.out.printf("The color is %s\n", gokart.getColor()); // capital K needed

Steve.

Like I said: dumb and obvious. =) Thanks all.

:smile: We all do it!!! :wink: :+1:

Kristian Gausel
Kristian Gausel
14,661 Points

you need to use the variable name with the correct capitilization you use gokart when it should be goKart =)