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


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)



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

thank you guys ..