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 trialmarvin acevedo
Courses Plus Student 204 Pointsi dont understand
i don't know what to do i did exactly what i needed to do
String blue equals "favoritecolor";
3 Answers
Emil Rais
26,873 PointsNow I'm not aware of the context, so I might be wrong, but if that's plain Java, then the following is up: String blue equals "favoritecolor"; is syntactically invalid Java.
What you're most likely after is a string "blue", and you want to examine whether it is equal to a variable called favoriteColor. Am I right? If that is the case you'll be after something like: "blue".equals(favoriteColor).
Sky Lu
419 PointsI just tested, this one sure can success: String favoriteColor = "Blue";
Sky Lu
419 PointsThe answer is string my favouritecolor = "blue"
Emil Rais
26,873 PointsThis is not syntactically correct.
If it is a variable declaration the type should have its first letter capitalized: String my favouritecolor = "blue". (Still invalid)
Spaces are not allowed in variable names and generally we camel case variable names in Java: String myFavouriteColor = "blue". (This is valid)