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 trialJoshua Lawson
4,953 PointsQuestion on initializing an array
Below the String variables, declare an array of Strings named 'titles'. Initialize it with the three String variables you just created.
This is what I have :
String title1 = "Android is awesome";
String title2 = "Mike is cool";
String title3 = "Treehouse loves me";
String[] titles = {"title1","title2","title3"};
I'm not getting this correct. It's saying "make sure you use the exact titles from step 1."
Will somebody show me what I did wrong?
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Joshua,
You have initialized the array with the strings "title1","title2","title3"
You want to initialize it with the title
variables so you need to drop all the quotes so that it's referring to the variable names, not strings of the variable names.
Joshua Lawson
4,953 PointsJoshua Lawson
4,953 PointsThank you so much!
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsYou're welcome.