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 trialAditya Saini
683 PointsWHAT THE HECK
Please someone help me.
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10)
randomNumber = intAsString.int
4 Answers
Samuel Moisan
11,953 PointsHi Aditya,
For your future question I suggest you to explain what you want to do with the code you provide, it will be easier for the community to help you.
I look on the challenge and it seem you need to convert randomNumber as an int, in the variable intAsString as a String. You can do this in multiple ways.
1
int number = 10;
String intAsString = number + "";
2
int number = 10;
String intAsString = Integer.toString(number);
3
int number = 10;
String intAsString = String.valueOf(number);
I hope this can help you!
Aditya Saini
683 Pointsbut.. treehouse says it is wrong
Samuel Moisan
11,953 PointsHi,
This method should work fine, this is the one they teach in the tutorial.
int number = 10;
String intAsString = number + "";
Aditya Saini
683 PointsIs it possible to ask tree house them self? Sorry but it still says " Bummer! There is a compiler error. Please click on preview to view your syntax errors!". I did that and it just made me confused.
Samuel Moisan
11,953 PointsI don't know if you can contact treehouse. Post the question and your code, it will be easier to me or the community to help you.
Aditya Saini
683 PointsHow do I contact them?
Aditya Saini
683 PointsAditya Saini
683 Pointsohhhhhhhhhhhh Thanks So Much!!!