Solved

Assume That We Have a Random Object Referenced by a Variable

Question 10

Multiple Choice

Assume that we have a Random object referenced by a variable called generator. Which of the following lines will generate a random number in the range 5-20 and store it in the int variable randNum?


A) randNum = generator.nextInt(15) + 5;
B) randNum = generator.nextInt(15) + 6;
C) randNum = generator.nextInt(16) + 5;
D) randNum = generator.nextInt(16) + 6;
E) none of the above

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions