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!
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
Filip Stefanovski2,371 Points
Don't know what to do here.
Tried declaring randomGenerator (Random randomGenerator = new Random ();) I also used int randomNumber = randomGenerator.nextInt (); .
Random randomGenerator; int randomGenerator = new Random ();
You might be on the second task? The code I posted will pass the first task of the challenge.
From memory, the second task requires you to create a new
int variable called
randomNumber and to use the
nextInt() method on the `
randomGenerator instance with no range set. Correct?
That looks like:
Random randomGenerator = new Random(); int randomNumber = randomGenerator.nextInt();
Is that where you are at?
The challenge comes with a
Random sized variable waiting for you to store your
new Random() in. You've got that bit of code, so just assign it into the existing variable either on a new line (delete the keyword
int) or all in one line:
Random randomGenerator = new Random();
I hope that helps ,