Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+12 votes

I have the correct answer for the problem,

"Write an expression that generates a random integer between 0 and 10 inclusive.

Random rand = new Random();
int n = ???;"

But when I enter "rand.nextInt(11);" the program tells me this is incorrect. I'm not sure what I am doing wrong here.

asked in CSC211_Winter2018 by (8 points)

2 Answers

+6 votes

Get rid of the semi-colon at the end. The "???"s is all that you are filling in for.

answered by (8 points)
+3 votes

I believe that int n = rand.nextInt(11) + 1;

rand.nextInt() + min;

answered by (8 points)
...