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 trialJulie Austin
1,322 PointsIt keeps asking if I forgot to return color but it's RIGHT THERE?!
I'm trying to add a public get string for the go kart color. My code looks the same as it did in practice but it keeps saying I forgot to return color and I'm super frustrated! I've rewatched the video like six times :(
class GoKart {
private String color = "red";
public String getColor(); {
return getColor; }
}
1 Answer
KRIS NIKOLAISEN
54,971 PointsCompare your code to that shown in the video @4:10
Some things to see:
- There is no semicolon following the method name
- The getter returns the private variable (in the video's case characterName) not the method name
Julie Austin
1,322 PointsJulie Austin
1,322 PointsThank you! Going back and knowing specifically what part of the video to check really helped. I could have sworn I started with that like 10 tries ago...oh well :/