I'm playing around with 2D arrays and I'm trying to print random numbers in a 3 X 5 matrix. So far this is what I have:
class 2DArray{
public static void main(String[] args){
int[][] array = new int[3][5];
double randnum = Math.random();
for(int i=0; i<array.length; i++)
{
for(int j=0; j<array[i].length; j++)
{
System.out.print(" " + i);
System.out.println(" " + j);
}
}
}
}I'm having trouble getting it to print in matrix form. Can anyone help me out?