Consider the following snippet of code: Random generator = new Random() ;
Int randNum = generator.nextInt(20) + 1;
Which of the following will be true after these lines are executed?
A) randNum will hold a number between 1 and 20 inclusive.
B) randNum will hold a number between 0 and 20 inclusive.
C) randNum will hold a number between 1 and 21 inclusive.
D) these lines will not be executed because a compiler error will result.
E) none of the above
Correct Answer:
Verified
Q14: Which of the following is an invalid
Q15: The new operator is used to access
Q16: The String class _ .
A) is part
Q17: The _ operator is used to instantiate
Q18: Which of the following best describes what
Q20: When two references point to the same
Q21: Write a short program that asks the
Q22: Write a single statement that creates a
Q23: When called with integer parameter n, the
Q24: The Math class is part 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