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

can't get this don't know what? sad I can't get this

did every thing in video what am I missing help me

RandomTest.java
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
String[] randomNumber  = {};

1 Answer

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

Hey Tremayne! Right now you're creating a String array object named 'randomNumber' and setting it equal to an empty set of curly braces. Instead, we need to create a String object named 'intAsString' and set it equal to our 'randomNumber' int object:

String intAsString = randomNumber;

But since 'intAsString' is a String, we need to cast our 'randomNumber' int to a String. An easy way to do this is to just add an empty String to our 'randomNumber':

String intAsString = randomNumber + "";

Hope that helps!