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 (retired 2014) Learning the Language Objects and Random Numbers

Kristian Olsson
Kristian Olsson
1,553 Points

Limit the randomGenerator

I am trying to make the third code work. int randomNumber = randomGenerator.nextInt(9);

This is the code that gives me an error, I dont see any other way to write it.

Pls help.

2 Answers

Masum Bergmann
PLUS
Masum Bergmann
Courses Plus Student 4,129 Points

Syntax seems to be good! What's the specific error message that you get? (hover with the mouse over the error to see message)

Make sure you have import java.util.Random; included in your imports (at the top of your file!).

Kristian Olsson
Kristian Olsson
1,553 Points

I figured it out, it was so simple and dumb Im not even going to comment on it...:p hehe

Thx though Masum.

Masum Bergmann
Masum Bergmann
Courses Plus Student 4,129 Points

Hehe! No worries! :D I'm just glad it's all working now...