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 The Solution

Edward Citalan
.a{fill-rule:evenodd;}techdegree seal-36
Edward Citalan
Python Development Techdegree Graduate 11,397 Points

Does not understand how class and arrays interact.

From TODO 2 onwards, I do not understand how class and arrays interact--can someone explain from todo 2--what each line of code is doing? I understand classes and arrays, but I do not understand how these two work together or the syntax.

1 Answer

Steven Parker
Steven Parker
229,005 Points

Class objects and arrays don't actually "interact" in any special way. So like "names" in step 1 contains strings, the array "cows" created in step 2 just happens to contain objects. The loops in the later steps just deal with the individual objects.

Try looking at it with that perspective and see if it becomes clear. If not, perhaps it will help you identify a more specific question.

Also, it looks like you have a Techdegree subscription. That still includes access to a Slack channel where you can interact live with staff Success Specialists, right? Don't overlook that resource!