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 trialsteve apgar
Courses Plus Student 568 Pointsnot sure how to do last part of challenge
i can't figure out this last part of this challenge, please help
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
2 Answers
Chase Marchione
155,055 PointsHi Steve,
We want to declare and initialize a string named intAsString, and we know that we want it to hold the value of randomNumber converted to String. The video shows a way in which you can convert that value to String: by concatenating an empty string to the value. Thus:
String intAsString = randomNumber + "";
Hope this helps!
David Anton
Courses Plus Student 30,936 PointsRandom randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
String intAsString = Integer.toString(randomNumber);