Java Foundations — Question 62

Which package would you import to use the Random class?

Answer options

Correct answer: C

Explanation

The correct answer is C, java.util, as the Random class is part of the java.util package in Java. Options A (java.io) and B (java.math) do not contain the Random class, while D (java.lang) is primarily for fundamental classes but does not include Random.