5
What’s the difference in using the random
without the import
, right in the method.
public class random {
public static void main(String[] args) {
int x = (int) (Math.random() * 10);
System.out.println(x);
}
}
Or with the import in the class, what’s the difference?
import java.util.Random;
public class random {
public static void main(String[] args) {
Random aleatorio = new Random();
int numero = aleatorio.nextInt(10);
System.out.println(numero);
}
}