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) Getting Started with Android Troubleshooting Java

plzz tell me how to use favouriteColor in coding it says bummer ur code was wrong

plzz tell me how to use favouriteColor in coding it says bummer ur code was wrong

Color.java
string myName="saish";
favoriteColor string myName="yellow";

1 Answer

Chase Marchione
Chase Marchione
155,055 Points

Hi there,

  • Each variable initialization needs its own line. This challenge only asks us to initialize one variable, so that makes things a little easier for us.
  • Generally speaking, the syntactical order of a Java variable initialization statement is: 1) The data type of the variable, 2) The name of the variable, 3) The assignment operator (=), and 4) the value of the variable, along with a semicolon to symbolize the end of the statement.
String favoriteColor = "yellow";

So, String is the data type of the variable, favoriteColor is the name of the variable, we include the assignment operator to assign a value to the variable, and then we added your favorite color, yellow, in quotes (since our value is a String), along with the semicolon to terminate the statement.

Hope this helps.

nice thank u i understood very well