Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+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 (1 point)

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 (1 point)
+3 votes

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

rand.nextInt() + min;

answered by (1 point)