how to print a matrix without braces in java

Solutions on MaxInterview for how to print a matrix without braces in java by the best coders in the world

showing results for - "how to print a matrix without braces in java"
Kassidy
22 Oct 2019
1var numbers = [4,3,2,1];
2console.log(numbers.join(' '));
3
4// 4 3 2 1
Valentina
11 Mar 2016
1for ( int i = 0; i < rows; i++) { //for each row
2  String row = Arrays.toString(matrix[i])
3    .replace(",", "")  //remove the commas
4    .replace("[", "")  //remove the left bracket
5    .replace("]", "")  //remove the right bracket
6    .trim();           //remove trailing spaces from partially initialized arrays
7  System.out.println(row);
8}
9          
10
similar questions