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 (retired 2014) Getting Started with Android Java Variables Explained

codeing

String myfavoriteColor = "white";

what is wrong with this code

3 Answers

Daniel Hartin
Daniel Hartin
18,106 Points

Nothing is wrong with your code as such, it would work fine in any java program however for the challenge you need to name the variable favouriteColor (not myfavouriteColor).

If you name the variable incorrectly it wont pass the check criteria.

By default convention in Java thus Android when naming variables what we use the camel casing i.e. the first letter of a word is in lowercase and the preceding first letters of next words are in uppercase

(Note -- again camel casing is not compulsory but is a general convention )

for e.g. helloWorld = hello (first word's first letter in lowercase) + World (next word's first letter in uppercase)

Similarly

myFavouriteColor

And as I checked and suggested by Daniel its favouriteColor and not myfavouriteColor ... remove the my and it should be good.

thank you guys ..