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 trialGavin Glisson
5,482 PointsCan't Complete task 4.
How do i put in this string Variable?
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
String fact = "";
3 Answers
marioganzer
1,515 PointsIn the video you can see the trick to convert any INT, DOUBLE, etc in a Sting, by using the '+'.
try to use: String intAsString = randomNumber + "";
Alwin Lazar V
5,267 PointsRandom randomGenerator = new Random(); int randomNumber = randomGenerator.nextInt(10); String fact = randomNumber + "";
Joyce Chidiadi
1,867 PointsThank you Alwin and Marioganzer. That worked.
Joyce Chidiadi
1,867 PointsJoyce Chidiadi
1,867 PointsI am having the same problems. Adding this string variable has been on my neck over 30 minutes now. Please help with the RandomTest.java
I have this as my code: String[] intAsString = {""};