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

Android

Guys I need help with Arrays, what are they talking about? Why do Android use so many different terms?

Declare an int variable named 'numberOfFrogs' and set it to the number of elements in the array using the array's 'length' property.

2 Answers

I haven't seen the problem you are talking about, but I can explain what this.. "Declare an int variable named 'numberOfFrogs' and set it to the number of elements in the array using the array's 'length' property" .. is saying. Arrays in most languages I guess(maybe all) have a "property" or it could be called a method/function attached to it behind the scenes that you can access that is called "length", which can tell you how many elements are in that particular array. So say you had created an array named "myArray" and you had 10 elements in it. And you have your int variable there named numberOfFrogs. You could write this code.. int numberOfFrogs = myArray.length; ..The length property would return an integer value of the number of elements in that array, and you would be assigning that value(of 10 here) to your numberOfFrogs variable. It should generally look like that in most languages, I've only worked with a few. I think you could maybe see something that looks like myArray.Length() in another language, but the principle I explained there with assigning the value from the length property is the same no matter what. Hope that helps in some way.

Thanks