Home »
MCQs »
Java MCQs
Which method in java is used to generate random numbers in Java?
45. Which method in java is used to generate random numbers in Java?
- random.nextInt()
- random()
- rand()
- All of these
Answer: A) random.nextInt()
Explanation:
The Java method random.nextInt() is used to generate random numbers.