I have an assignment to populate the array with random number ranging from 0-9. Then print it out in a rectangular format. I'm already having trouble trying to put random integers in the array. Please point me in the right direction
import java.util.*;
public class ThreebyFour
{
public static void main (String[] args)
{
int values[][] = new int[3][4];
for (int i = 0; i < values.length; i++)
{
for (int j = 0; j < values.length; j++)
{
values[i][j] = ((int)Math.random());
System.out.println(values[i][j]);
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire