Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java The Solution

Edward Citalan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Edward Citalan
Python Development Techdegree Graduate 11,057 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
217,518 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!