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 trialToma Morris
Courses Plus Student 65 PointsSet the favorite color variable to your favorite color
Set the favorite color variable to your favorite color
yourfavoriteColor String equals "";
3 Answers
Emil Rais
26,873 PointsIn Java you create variables according to the following syntax:
Type variableName = "value";
For example:
Number age = 23;
Toma Morris
Courses Plus Student 65 PointsWhat am I suppose to write for favoritColor string equal " " ?
I had favoriteColor = "Gold" but it keeps saying I'm wrong
Emil Rais
26,873 Points"Gold" is of type String, so you need to make sure that you specify that. Don't forget the semi colon.
String favoriteColor = "Gold";
That should work well.
Toma Morris
Courses Plus Student 65 Points:) thank you