Solved

Consider the Following Snippet of Code: Random Generator = New

Question 19

Multiple Choice

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:

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