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 trialMatthew McGuff
4,355 PointsWhy not: fact = (String) randomNumber?
It clear from the auto correction in Android studio that this isn't possible but on not sure why? Seems like these should be compatible types seeing as the
randomNumber + " "
forces the int to become a string. Why does casting not work here when it seems to be performing something of a cast the concat?
Matthew McGuff
4,355 PointsMatthew McGuff
4,355 PointsAnswered my own question. This is possible but not with the syntax used above. you would want to use:
fact = String.valueOf(randomNumber);
Will test further but this seems like would work just the same. Let me know if you reach a different conclusion. Found the answer below:
http://stackoverflow.com/questions/15836797/android-how-to-convert-int-to-string