Simple question about array println
in
Programming Questions
•
8 months ago
Hi everyone,
I have a very simple question regarding println() function for 2-dimensional arrays in console (or printWriter). I need the rows on 2D matrix to be displayed horizontally, while println() function prints all values vertically one by one. Basically, for
int [][] array1 = {{1,2,3,4},{5,6,7,8}}; I need it to be displayed on the console as:
1 2 3 4
5 6 7 8..
I know that it is possible to do that by introducing additional string arrays, but I was wondering if there is a simplier way of doing it. In previous versions of Processing, it could be done by
for (int i=0;i<array1;i++){print(" "+array1[i]);} but it does not seem to work anymore (yields smth like [I@1fbbd7b2 [I@61acfa31)
Thank you very much for your help!
1