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 (2014) Basic Android Programming Using the Random Class

Uros Dukic
Uros Dukic
1,001 Points

android coding problem

I have problem in code challenge.In preview I got this massage.

JavaTester.java:21: ';' expected int randomNumber +""; ^ 1 error

3 Answers

Eric De Wildt
PLUS
Eric De Wildt
Courses Plus Student 13,077 Points

The problem is with your syntax and how you interpreted the instructions. Your code is almost correct, it should look like this:

Random randomGenerator = new Random();

thank you

Eric De Wildt
Eric De Wildt
Courses Plus Student 13,077 Points

Your welcome, please vote my answer as best if it was please.

The answer is much simpler than you think :)

Initialize a new Random variable called randomGenerator using the Random() constructor.

And you already have : Random randomGenerator;

Random = Type of variable randomGenerator = variable name

What should follow after that ? the Random() constructor

How do you initialize? new Random()

Always close with ';'

Connect the statements ;) Get your thinking cap on :)! It sounds difficult now but you will get it with more practice.

Eric De Wildt
PLUS
Eric De Wildt
Courses Plus Student 13,077 Points

If you are still stuck then lets have a look at your code and we can figure it out together.Please post the code you are trying to use.

Random randomGenerator=newRandomConstructor(); pliz help me