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 Build a Simple Android App (2014) Coding the Fun Facts Using an Array

String [] sports = { "bestSport", "Basketball", "Baseball", "Tennis" }; Is "bestSport" declared first in this code?

My goal is to declare "bestSports" as the first variable in this array. Does this look right to you? I'm unable to move forward

Array.java
String [] sports = { "bestSport", "Basketball", "Baseball", "Tennis" };

3 Answers

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

The issue might be that it is 'bestSport', not 'bestSports'. Is that it?

No, that didn't help. I figured out how to move on with the course. I hate leaving the challenge unanswered but I have to move on :)

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

I got it!

You create an empty string:

String bestSport;

Then assign it to the first string in the sports array:

bestSport = sports[0];
Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

Or I think you could do it all in one line:

String bestSport = sports[0];