I am having trouble with the RandInt()
method as it will not return a random integer. The result must be an int ranged 0-9
and must use the math.random class. This is my code below:
public class RandNumGenerator {
public static int RandInt() {
int n = (int) Math.random() * 10;
return n;
}
public static void main(String[] args) {
RandInt();
}
}
Aucun commentaire:
Enregistrer un commentaire