so, I'm trying to print multidimensional arrays with print statements
output of row 0: 2 3 6 8 10 12 14 16,
output of row 1:4 6 8 10 12 14 16 18
and output of row 2: 6 8 10 12 14 16 18 20
Code:
public static void main(String [] args) {
int [][] array = {{2,4,6,8,10,12,14,16},{4,6,8,10,12,14,16,18},{6,8,10,12,14,16,18,20}};
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.print(array[i][j] + " ");
}
}
}
System.out.println();after the inner loop?Arrays.asList(array).forEach(a -> System.out.println(Arrays.toString(a)));guesswhat you could probably be asking !