I was wondering what the best way of printing a 2D array was. This is some code that I have and I was just wondering if this is good practice or not. Also correct me in any
I would prefer generally foreach when I don't need making arithmetic operations with their indices.
foreach
for (int[] x : array) { for (int y : x) { System.out.print(y + " "); } System.out.println(); }