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

WHAT THE HECK

Please someone help me.

RandomTest.java
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10)
  randomNumber = intAsString.int

4 Answers

Samuel Moisan
Samuel Moisan
11,953 Points

Hi 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!

ohhhhhhhhhhhh Thanks So Much!!!

but.. treehouse says it is wrong

Samuel Moisan
Samuel Moisan
11,953 Points

Hi,

This method should work fine, this is the one they teach in the tutorial.

int number = 10;
String intAsString = number + "";

Is 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
Samuel Moisan
11,953 Points

I 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.

How do I contact them?