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

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

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.