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
Darren S
1,738 PointsCode Challenge: Objects and Random Numbers
I cant seem to figure this one out...can anyone please help?
The Question Reads:
Declare a String variable named intAsString. Convert the randomNumber integer to a String value and store it in the intAsString variable. Hint: Use the toString() method of the Integer class.
Below is what I had done correctly up until the 4th objective above.
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
answer = Integer.toString(randomNumber);
5 Answers
Ryan Carson
23,287 PointsHi Darren,
What project is this Code Challenge related to?
Ryan
Ben Jakuben
Treehouse TeacherSorry about your trouble! You have the right side of the last statement correct, but check what you have on the left side of the equals sign, and then re-read the first sentence of the task. :-)
Darren S
1,738 Points@ Ryan - It was the Build a Android App
@ Ben - Thanks for trying to help...still not getting it and I must have tried all possible variations except for the right one :S
Going bat crap crazy....
Ben Jakuben
Treehouse TeacherSorry - I thought my last tip would be enough! You're assigning to answer on the left side of the last line, which isn't a valid variable name. You need to assign to a new String variable named "intAsString": String intAsString = ....
McJemayel Imbayan
Courses Plus Student 1,529 PointsYou guys are awesome !!!