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:
Verified
Q118: What will be the output of the
Q119: What is the last output line of
Q120: What is the output of this code
Q121: Suppose that the chance to hit the
Q122: What does the following code snippet display?
Q123: Which of the following is the correct
Q124: How many times does the following loop
Q126: Which of the following is correct for
Q127: What does the following code do?
Int sum
Q128: What is the data type of the
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents