Solved

Which of the Following Code Snippets Will Generate a Random

Question 125

Multiple Choice

Which of the following code snippets will generate a random number between 0 (inclusive) and 79 (inclusive) ? (Assume Random generator = new Random() ;)


A) int val = generator.nextInt(79) + 1;
B) int val = generator.nextInt(80) - 1;
C) int val = generator.nextInt(79) ;
D) int val = generator.nextInt(80) ;

Correct Answer:

verifed

Verified

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

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