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!
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

Chanse Strode
19,562 PointsLearning the Language: Code Challenge: Objects and Random Numbers
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
intAsString = Integer.toString(randomNumber);
why is this not working?
3 Answers

Stone Preston
42,016 Pointsi dont know java but it looks like you are missing the data type for your string just from looking at your other code

Philip Larson
7,553 PointsAs Stone Preston said, it seems like you have missed to define the variable intAsString?
I think it should be:
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
String intAsString = Integer.toString(randomNumber);

Chanse Strode
19,562 PointsThank you very much! I was sleep deprived last night and looked over that like 20 times!