This very basic code prints my 2D array row by row.
public class scratchwork {
public static void main(String[] args) throws InterruptedException {
int[][] test = new int[3][4];
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 4; col++) {
System.out.print(test[row][col] = col);
}
Thread.sleep(500);
System.out.println();
}
}
}
How can I edit the loops to print the array column by column?
Edit: just want to clarify that the output is
0123
....
0123
....
0123
with the dots representing not actual white space but the half second sleep time. What I'm trying to output is
0...1...2...3
0...1...2...3
0...1...2...3
So I am trying to print the columns a half second apart from each other.