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 trialMUZ140831 Blessing Funani
654 Pointshelp
declaring a string named sports
1 Answer
Chase Marchione
155,055 PointsHi Blessing,
1) The syntax to make a String array is 'String[]'. The brackets denote that you want an array, and by typing in String before the brackets, you tell the compiler what data type you want the array to be of.
2) Next, name the array. The challenge wants us to name it 'sports', so we'll do just that.
3) Use the curly brace syntax to plug in the three values. We need a semicolon at the end of the statement to tell the compiler that the statement has ended (the way we use periods in English to end a sentence).
String[] sports = {"football", "baseball", "basketball"};
Hope this helps!
MUZ140831 Blessing Funani
654 PointsMUZ140831 Blessing Funani
654 Pointsthank you