Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

cm21
cm21
150,854 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