Solved

Which of the Following Code Snippets Will Generate a Random

Question 96

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