I have a matrix : 5×15 :
for(int i=0;i<5;i++){
for(int j=0;j<15;j++){
String[][] Matrix = { { "0", "0", "", "0", "5", "6", "", "", "55", "", "", "", "", "" }, { "1723", "0", "", "0", "0", "3", "", "", "2", "", "", "", "", "" },
{ "10", "0", "", "0", "0", "0", "", "", "0", "", "", "", "", "" }, { "69", "0", "", "0", "0", "20", "", "", "100", "", "", "", "", "" },
{ "35", "0", "", "0", "15", "20", "", "", "57", "", "", "", "", "" } };
system.out.println(Matrix);
}}
and I need to print each line : line1,line2,..line5
Remove the
system.out.println(Matrix);and add at the end (outside the two loops):Arrays are not printed readable, but collections like List are.
PS: by convention, variables start with lowercase, types and constants with uppercase