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 trialCamilleMarie Paugam
1,521 PointsObject comes out to "null"
Every time I try to print the name, it comes out to "null." Not sure how to fix it.
1 Answer
Steven Parker
231,184 PointsOn line 8 of Cow.java, you have name = "Camille";
which just overwrites the parameter instead of setting the class property (leaving the property "null"). Plus, it always sets the name "Camille" instead of the argument that was given.
In the video, the code shown for that line is this.name = name;
which sets the property using the parameter.
You might want to review this part of the video.