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 trialRandall Lakey
2,486 PointsAndroid Development;Stage 2 Learning the Language challenge task
I feel like I am doing this right but I am getting an error. Can anyone verify this please? The answer is line 2. Thank you in advance.
Now limit the range of the randomNumber variable from 0 to 9. Use the version of 'nextInt()' that has a parameter that specifies how many numbers to choose from.
Bummer! Check the parameter you're using for 'nextInt()'. Hint: 0 through 9 is a total of 10 choices. Preview Recheck work
random.java
1Random randomGenerator = new Random();
2int randomNumber = randomGenerator.nextInt(3);
3 Answers
Patrick Cooney
12,216 PointsHint: Check the argument you are providing to nextInt().
Randall Lakey
2,486 PointsIam so new to this stuff....."check the argument"? Are you speaking in Chinese parables ? :)
Patrick Cooney
12,216 PointsSorry. Argument and parameter are somewhat interchangeable. What Ben calls the parameter in this example I called the argument. It's what you passed into the ( ) at the end. Try changing that number.
Randall Lakey
2,486 PointsI will try changing the number. Thank you.