Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Simple Android App Basic Android Programming Using the Random Class

Tremayne Clinton
Tremayne Clinton
5,417 Points

what am I missing

can't get this

RandomTest.java
Random  randomGenerator = new Random();
int randomNumber =  randomGenerator.nextInt(10); 
intAsString = intAsString  [randomNumber] ; // delete
intAsString = randomNumber + ""; // delete

I added comments in your code; then follow the post below. :smile: :+1:

1 Answer

Hi Tremayne,

You're just missing the last line.

Add an empty string to randomNumber and assign that (with an equals sign) into intAsString.

String intAsString = randomNumber + "";

This converts the int, called randomNumber into a string and stores it in intAsString.

Let me know how you get on.

Steve.