Java-打印2D數組的最佳方法?我想知道打印2D數組的最佳方法是什么。這是我有的一些代碼,我只是想知道這是否是一個很好的實踐。如果您發(fā)現任何其他錯誤,也請糾正我在這段代碼中所犯的錯誤。謝謝!int rows = 5;int columns = 3;int[][] array = new int[rows][columns];for(int i = 0; i<rows; i++)
for(int j = 0; j<columns; j++)
array[i][j] = 0;for(int i = 0; i<rows; i++){
for(int j = 0; j<columns; j++)
{
System.out.print(array[i][j]);
}
System.out.println();}
Java-打印2D數組的最佳方法?
慕尼黑8549860
2019-10-12 07:07:12