Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Print numbers in a matrix



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