Solved

Assume That We Have a Random Object Referenced by a Variable

Question 3

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

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents