I haven't used 2D Arrays before so apologies for any 'obvious statements'. I want to create a 2D Array for a 15 by 20 'table' and want the following to be applied:
- I want each row to be a separate Array.
- I want each row to have random 0's and 1's generated
The code I have created creates the 15 x 20 table but not sure if each row is an Array and can't figure out how to put random 0's and 1's. Help would be appreciated! Thanks!
for (int i=0; i < ar.length; i++) {
for (int j=0; j < ar[i].length; j++) {
ar[i][j] = 0;
System.out.print(" " + ar[i][j]);
}
System.out.println("");
}