Home / Programming MCQs / JAVA MCQs / Question

Q. Which method in java is used to generate random numbers in Java?

(A) random.nextInt()
(B) random()
(C) rand()
(D) All of these

Explanation:

The Java method random.nextInt() is used to generate random numbers.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.