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

Jamaru Rodgers
3,046 PointsDeclare a String variable named intAsString. Convert the randomNumber integer to a String value and store it in the intA
Help Me
Random randomGenerator = new Random();
int RandomNumber = randomGenerator.nextInt(10);
fact = randomNumber + "";
3 Answers

James Simshaw
28,738 PointsHello,
You're close, this task is asking you to declare a String named intAsString instead what you called fact.

Angelic Williams
623 PointsI'm having the same problem. My answer was the following:
Random randomGenerator = new Random ();
int randomNumber = randomGenerator.nextInt(10);
intAsString = randomNumber + "";

James Simshaw
28,738 PointsHello,
You forgot to declare your intAsString variable and give it a type. You can either do that on the same line or on a seperate line. For example,
int someInt = 0;
has the type, variable name, and value all one one line. You could also just declare a variable then initialize it on another line by
int someInt;
someInt = 0;

T K
1,875 PointsThe code goes like this...
Random randomGenerator = new Random(); int randomNumber = randomGenerator.nextInt(10);
(Till here you have done...the next step is to DECLARE the 'intAsString' as a String....it is to be done the following way)
String intAsString = "";
(And then 'Moosh' up the variables)
intAsString = randomNumber + "";