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 trialColt Shelby
1,175 PointsDoes the order of equations matter?
I found that the correct code for this challenge is:
public class GoKart {
private String mColor = "red";
public GoKart(String color) {
mColor = color;
}
public String getColor() {
return mColor;
}
}
Originally I couldn't find the source of my error but I fixed it by switching
color = mColor;
to
mColor = color;
Why does the order of this matter?
1 Answer
Alexander Davison
65,469 PointsIn algebra, "x = 0" is the same thing as saying "0 = x". However, for a computer (or at least for Java), you must keep the order like "x = 0" because it is easiest to read. :)
P.S.: I'm not sure if there's a programming language that allows "0 = x" syntax...you never know what there might be! :)
Hope that helps and happy coding!
Colt Shelby
1,175 PointsOkay! Thanks a lot!
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsNo problem!