Java – two dimentional array example
import java.util.Arrays; public class Main { public static void main(String[] args) { int[][] arr = new int[3][10]; // 3 rows, 10 columns Arrays.fill(arr[0], 1); // 1st row fill all columns values by 1 Arrays.fill(arr[1], 2); // 2nd row fill all columns values by 2 Arrays.fill(arr[2], 3); // 3rd row fill all columns values by 3 for (int[] row: arr) { for(int v: row) { System.out.print(v + " "); } System.out.println(""); } } }
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3